ASP.NET MVC http://xxxx.com/CoM1 HTTP 404

Problem:

http://xxxx.com/CoM1 does not route properly. 

I gets a HTTP 404 error. 

The Requested URL: /CoM1

Cause:

It turns out “COM1” is reserved by default.  The list of reserved URL include: COM1-9, LPT1-9, AUX, PRT, NUL, CON.

Fix:

Add “relaxedUrlToFileSystemMapping” attribute to the web.config httpRuntime.

   1: <system.web>

   2:     ...

   3:   

   4:   <!-- 10/4/2016 HW: relax the Url to FileSystem Mapping so we can use http://xxxx.com/CoM1 .  Otherwise, it treats COM1 as the special COM port 1 -->

   5:   <httpRuntime targetFramework="4.5.1" relaxedUrlToFileSystemMapping="true" />

   6: </system.web>

 

Reference:

http://haacked.com/archive/2010/04/29/allowing-reserved-filenames-in-URLs.aspx/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s