Use URLEncode

  • Thread starter Thread starter Grey
  • Start date Start date
G

Grey

How can I use the URLEncode in ASP.NET?? If i used URLEncode to encode the URL, how can I decode the URL with proper parameter values in ASP.NET?? I can encode the URL, but i cannot decode it properly...

Million Thanks..
 
You can use HttpUtility.UrlDecode to decode it.

Av.
How can I use the URLEncode in ASP.NET?? If i used URLEncode to encode the URL, how can I decode the URL with proper parameter values in ASP.NET?? I can encode the URL, but i cannot decode it properly...

Million Thanks..
 
the good thing is\s you don't have to worry about it.

for instance,
dim invalid_param as string = "abc/\/\&#x y z"
Response.Redirect("page.aspx?param=" & Server.URLEncode(invalid_param))

then inside of page.aspx......
dim theVariable as String = Request.parameters("param")


theVariable is now equal to "abc/\/\&#x y z". Since it was URLEncoded it it placed corrently into the QueryString. Because the params collection (or QueryString Collection) makes the assumption that you want it to be decoded.

How can I use the URLEncode in ASP.NET?? If i used URLEncode to encode the URL, how can I decode the URL with proper parameter values in ASP.NET?? I can encode the URL, but i cannot decode it properly...

Million Thanks..
 
Back
Top