I have a page where I am recieving an url in a parameter like this:
www.example.com?url=www.myurl.com?urlparameter1=hey
The problem is that when I try to retrieve the parameter “url”, I only receive “www.myurl.com” instead of “www.myurl.com?urlparameter1=hey”. What is the best way to receive the url, is it to extract the whole url and remove http://www.example.com or is there a more efficient way?
You need to URL encode your URL parameter, otherwise it will be read as separate querystring parameters.
Use HttpUtility.UrlEncode.
Do this: string urlParameter = HttpUtility.UrlEncode(“www.myurl.com?urlparameter1=hey”);
That will give you: http://www.myurl.com%3furlparameter1%3dhey
http://msdn.microsoft.com/en-us/library/system.web.httputility.urlencode.aspx