Request url parameter

I have a page where I get the url in a parameter like this:

www.example.com?url=www.myurl.com?urlparameter1=hey

The problem is that when I try to get the "url" parameter, I only get "www.myurl.com" instead of "www.myurl.com?urlparameter1=hey". What is the best way to get the url, do i need to extract the whole url and delete www.example.com or is there a more efficient way?

+2
source share
3 answers

The URL must be encoded with the URL, otherwise it will be considered a separate request parameter.

Use HttpUtility.UrlEncode.

Do this: string urlParameter = HttpUtility.UrlEncode ("www.myurl.com?urlparameter1=hey");

: www.myurl.com% 3furlparameter1% 3dhey

http://msdn.microsoft.com/en-us/library/system.web.httputility.urlencode.aspx

+6

, url ( , )... urlencoded , '?' '=' . HttpServerUtility.UrlEncode , URL-.

... - , , , , , URL-.

+2

"?", "&". , .

URL, URL.

+1
source

All Articles