Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hello Friends,
 
I have been working with the Url Rewriting for my ASP.NET (3.5) web application. I am following the global.asax 's Application_BeginRequest event and have succcessfully mapped very simple urls to the appropriate web page in my web application.
 
Urls mapped successfully
http://myserver/abc.htm and I can easily map this to http://myserver/default.aspx
with Context.Rewrite Path.
 
The problem arises with this method when I want to use special characters or wild card characters in my Urls e.g
 
http://myserver/a:bc.htm gives( HTTP Error 400 - Bad Request )
http://mysever/abc..htm gives(HTTP Error 400 - Bad Request )
http://myserver/abc?.htm gives(HTTP Error 400 - Bad Request )
 
and even if i encode my Urls as
http://myserver/a%3Abc.htm (HTTP Error 400 - Bad Request.)
 

Please help me out as application needs these kind of Urls to be there.
 
Thanks
Posted 30-Oct-12 22:24pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Try this setting in config file
 
<system.web>
    <httpRuntime requestPathInvalidCharacters="" requestValidationMode="2.0" />
    <pages validateRequest="false" />
</system.web>
  Permalink  
Comments
softobizuser at 31-Oct-12 3:59am
   
Thanks venkat for your reply.
 
I already tried this solution with ASP.NET 4.0 where this attribute was introducted. But its not handling the url of following kind
 
http://myserver/a:bc.htm (HTTP Error 400 - Bad Request.)
 
and not even its encoded version
http://myserver/a%3Abc.htm (HTTP Error 400 - Bad Request.)
 
and throws an error as specified above.
 
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web03 | 2.8.150327.1 | Last Updated 31 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100