ASP.NET 4.0, webform site
There is a link in my site is to call another page and pass url parameters, it looks like below.
http://www.foo.com/foo.aspx?anotherURI?param1=aaa&26param2=bbb
However, I need to do url encode for "anotherURI?param1=aaa&26param2=bbb", so it turns into:
http://www.foo.com/foo.aspx?anotherURI?param1%3Daaa%26param2%3Dbbb
Now if I want to enclose this with javascript, it won't work. How do I encode the url again?
javascript:void(window.open('http://www.foo.com/foo.aspx?anotherURI?param1%3Daaa%26param2%3Dbbb', 'popup'))
Correct the URI:
WRONG: http://www.foo.com/foo.aspx?anotherURI?param1%3Daaa%26param2%3Dbbb
RIGHT: http://www.foo.com/foo.aspx?anotherURI=param1%3Daaa%26param2%3Dbbb
Example for multiple URIs: http://www.foo.com/foo.aspc?uri1=[encodedURI]&uri2=[encodedURI2]
To get a value from a queryString variable on asp.net:
Dim sUrl1 as String = request("VarName")
Dim sUrl2 as String = request("VarName")
Dim sUrl3 as String = request("VarName")
If you want to get the decoded URL from that variable:
Dim sDecodedUrl1 as String = Server.UrlDecode(sUrl1)
Dim sDecodedUrl2 as String = Server.UrlDecode(sUrl2)
Dim sDecodedUrl3 as String = Server.UrlDecode(sUrl3)