Hi all

In my application developed in asp.net 4.0 i am using url routing technique. There is a text box in which user enters title of an ad and this title will be the URL to next page.

My problem is when user enters special characters like & or % it gives bad request error. How can i handel all special characters in URL. Any ideas??

Use the HttpUtility.UrlEncode(String) method. It will take the string and turn the special characters into URL compatible code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.