tags:

views:

151

answers:

1

I'm hard coding a url to have something like this:

"/ContactUs.aspx?mode=New&form=Contact"

the page is rendering the below as part of the url...

mode=New&amp%3bform=Contact

so the page breaks when i rediriect to this page. and try to Request.QueryString["form"].

how can i make it behave with the & symbol

+2  A: 

Have you tried escaping the ampersand using the HTML entity & ? Ampersands in URLs must be escaped. You should also URL Encode any values passed in the query string - I think HttpUtility.UrlEncode() does that (off top of my head).

For instance, your URL should be:

/ContactUs.aspx?mode=New&form=Contact

However, you don't need to do this if you are using an <asp:HyperLink /> , as NavigateUrl properties are automatically encoded.

See this article on URL Encoding for why you need do this. In .NET you can use the HttpUtility.UrlEncode method to do this. This is also accessible via Server.UrlEncode of current HttpContext.

Dan Diplo
I need more info please. thanks
raklos
I've tried to expand my explanation above.
Dan Diplo