Click here to Skip to main content
Rate this: bad
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.
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 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.

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

  Print Answers RSS
0 OriginalGriff 190
1 Jochen Arndt 155
2 PIEBALDconsult 150
3 Afzaal Ahmad Zeeshan 120
4 DamithSL 115
0 OriginalGriff 5,695
1 DamithSL 4,591
2 Maciej Los 4,012
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190

Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 31 Oct 2012
Copyright © CodeProject, 1999-2014
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