Click here to Skip to main content
15,886,830 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

1 solution

Try this setting in config file

XML
<system.web>
    <httpRuntime requestPathInvalidCharacters="" requestValidationMode="2.0" />
    <pages validateRequest="false" />
</system.web>
 
Share this answer
 
Comments
softobizuser 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900