简体   繁体   中英

IIS URL issue for a ASP.Net application

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?

Assuming the error is when the link is used from your ASPX you need to URL encode the 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});

Any dynamic string data should be URL encoded in query string.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM