0

I have a hyperlink on my aspx which will take to users to

http://something/leadoc/FnJavaView.aspx?Library=DefaultIMS:myserver:FileNet&Id=3611376&ObjType=2&Op=View

I have the same link on another web application, when users click on that link it is showing something like below

http://something/leadoc/FnJavaView.aspx?Library=DefaultIMS%3amyserver%3aFileNet&Id=3611376&ObjType=2&Op=View

If you notice the ':' is converted to %3a

because of that URL is throwing an error.

Could you please help?

4

1 に答える 1

0

リンクが ASPX から使用されたときにエラーが発生したと仮定すると、URL をURL エンコードする必要があります。

string url = "http://something/leadoc/FnJavaView.aspx?Library={0}&Id={1}&ObjType={2}&Op={3}";
string library = Server.UrlEncode("Server.UrlEncode");
int id = 3611376;
int objType = 2;
string op = Server.UrlEncode("View");

url = string.Format(url, new object[]{library, id, objType, op});

すべての動的文字列データは、クエリ文字列でエンコードされた URL である必要があります。

于 2012-05-23T23:44:24.060 に答える