1

We're using MVC .NET and the RouteCollection class to route URLs in our web app. This functions normally until we pass a URL containing the the text "PRN" anywhere inside the URL. When this happens, the routing will not occur and a 400 Page Not Found error is returned to the client. It's like something is throwing the error before the routing collection is even consulted, because the route the URL should take is never touched (by that I mean the underlying code's break-point is never hit, though the exact same URL without the string "PRN" will hit the break-point).

So I thought it might be a page validation issue, that maybe Microsoft decided to throw exceptions when the URL contains the phrase "PRN" because it is like "print" or "porn" but if that were the case then we'd see the "A potentially dangerous Request.Form value was detected from the client" error, but we don't.

Researching this has been a hassle because Google thinks PRN should return results for "porn", which means 98% of my search results are invalid (and inappropriate). Using the "-porn" clause in Google drops your results down to about 10-30 hits, all useless.

Does anyone know why a URL containing the string "PRN" will not route properly? If you have any posts or threads to point me to, that would be awesome (again, Google has failed me).

tereško
  • 58,060
  • 25
  • 98
  • 150
Bryce
  • 11
  • 1
  • Could you please show the routes and the url you are trying to hit. – AD.Net Jun 15 '11 at 13:37
  • I should have mentioned it's a web service. So, the URL is something like loremepsum/PRN/loremepsum and it returns: Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested URL: /loremepsum/PRN/loremepsum – Bryce Jun 24 '11 at 20:29
  • Well, after some searching online I found an article that seemed to answer the question for me. To sum up quickly, the issue is that certain file extensions are reserved in .NET, and so certain URLs will always fail because .NET is trying to find a file that doesn't exist. [link](http://www.iteye.com/topic/407734) – Bryce Jul 05 '11 at 16:45
  • If any one cares, this will fix the issue: as answered here: http://stackoverflow.com/questions/987105/asp-net-mvc-routing-vs-reserved-filenames-in-windows – Bryce Jul 06 '11 at 14:00

0 Answers0