Last post Jan 08, 2010 10:23 AM by king ragu
Jan 07, 2010 10:27 AM|king ragu|LINK
I'm writing an MVC app using VS2010 beta 2 and I am required to support URLs which may have an escaped colon in the URL path (e.g. www.blah.com/search/9%3a30/). It seems as though escaped colons should be acceptable according to the URI specs. I know this
was not supported in previous versions of Asp.Net but it appears that as of version 4 beta it should be able to accept it without giving a 400 error.
Quote from asp.net 4 beta 2 whitepaper:
By default the "requestPathInvalidChars" attribute contains seven characters considered invalid (the less than and greater than signs as well as the ampersand are encoded since configuration is an Xml file). Developers can then expand or reduce the set of invalid
characters as appropriate for their application's needs.
Also from this thread on stackoverflow (http://stackoverflow.com/questions/948428/asp-net-http-400-bad-request-error-when-trying-to-process-http-localhost5957) Stefan said he managed to get colons working in pre-release version of .net 4 beta 2.
So far I've been unable to get this to work at all. Can anyone tell me if there is a solution for this?
Jan 07, 2010 02:23 PM|pixelsyndicate|LINK
I have encountered issues where I needed to use a colon (:) in a URL; specifically because they are used in Report Server report URLs, though not as part of the URL (in which case it would be an indication of a port number being specified), but in the QueryString.
In my C# code-behind, I was able to use the colon, but when specifying such URL/QueryStrings in my Web.config (where XML is used and very stringent) I was able to get around this using : for replacement of the :
See it that works.
Jan 08, 2010 10:23 AM|king ragu|LINK
Thanks for the answer. I want to use a colon in the path of the URI. It should be a valid url if it's escaped (eg. http://localhost/search/things%20at%209%5800 - I know its ugly!). I know before hand ASP wouldn't allow even an escaped colon in the path or
a uri but apparently in asp.net 4 beta 2 this has now been permitted by removing the colon from the httpruntime.requestpathinvalidcharacters property. I just can't seem to get it to work.
ASP.NET 4 Framework