In our ASP.NET MVC application, we've noticed that we cannot have The Forbidden DOS File Names—COM1 through COM9, LPT1 through LPT9, CON, AUX, PRN, and NUL—anywhere in our routes. They inevitably result in IIS telling us the file cannot be found, even when we set routing not to check for the existence of files first. How can we work around this?
COM1
COM9
LPT1
LPT9
CON
AUX
PRN
NUL
This has been addressed in ASP.NET 4. http://haacked.com/archive/2010/04/29/allowing-reserved-filenames-in-URLs.aspx
You can apply a setting in web.config that relaxes this restriction.
<configuration> <system.web> <httpRuntime relaxedUrlToFileSystemMapping="true"/> <!-- ... your other settings ... --> </system.web> </configuration>
Hope that helps.
1.4m articles
1.4m replys
5 comments
57.0k users