I'm trying to configure my IIS 7.5 to allow specials chars in the url for ASP.NET. This is important to support wide-spread legacy url's on a new system.
Sample url: http://mydomain.com/FileWith%inTheName.html This would be encoded in the url and requested as http://mydomain.com/FileWith25%inTheName.html
This simply works, when creating a new web in IIS 7.5, placing a file with the percentage sign in the file name in the web root and pointing the browser to it.
This does not work, however, when the web site is an ASP.NET application. ASP.NET always returns a 400.0 - Bad Request
error in the WindowsAuthentication
module from the StaticFile
handler, when pointing to that url. It however displays the requested url correctly and also resolves correctly to the correct physical file (the information from the field 'Physical Path' from the Server error page points to the physically available file).
There are hints on how to enable this, so I followed the instructions on these websites step by step:
- http://dirk.net/2008/06/09/ampersand-the-request-url-in-iis7/
- http://adorr.net/2010/01/configure-iis-to-accept-url-with-special-characters.html
The second one actually sums up the information from the first post and adds some more information about x64 systems (we're running x64) and on an additional web.config change for this. I tried all that, and still can't get this running from an asp.net web application. And yes: I rebooted after applying the registry changes.
So, what do I have to do in addition to the settings described in above posts, to support the legacy url's which contain percentage characters?
Additional info: Application Pool mode is integrated.
Push after some days. No idea anyone?
Happened to me, after doing all the modifications to the Windows Registry I was stuck as you were. Problem was fixed once I changed the Application Pool mode into Classic.
Ampersand symbols unless in-between "/" and "/" and before "?" symbols are logical operators for URI and URLs, down to the RFCs that defined them. You would have to work pretty hard to use something like:
and not:
url_encoded values and raw ascii representation works pretty well, for example an RHO which acts as an ASP.NET Gateway Filter. Generally when I code ASP.NET, I almost never fob with the IIS unless it is a core config module or plugin. ASP.NET supports full state coverage in the API.
Almost all languages with web API support translation of url encoded characters naturally. Writing a small class which handles your gateway requests and parses your request string is an easier way of dealing with special symbols than toying with IIS in registry.
Keep in mind high-level character restriction that can cause buffer overflows. Make sure that high-bit characters and specific repeat characters do not allow overflow exceptions. You can type the letter a past U+1000 but you only really need it at U+0097 or its multiple for a layered request.