Click here to Skip to main content
11,924,800 members (56,040 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET web-dev
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.

Posted 30-Oct-12 22:24pm

1 solution

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

Solution 1

Try this setting in config file

    <httpRuntime requestPathInvalidCharacters="" requestValidationMode="2.0" />
    <pages validateRequest="false" />
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.


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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web03 | 2.8.151125.3 | 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