Use URLEncode

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..
 
A

avnrao

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..
 
D

David Jessee

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..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top