Home Dots in URL causes 404 with ASP.NET mvc and IIS

Dots in URL causes 404 with ASP.NET mvc and IIS

user9768
1#
user9768 Published in September 21, 2018, 8:36 am

I have a project that requires my URLs have dots in the path. For example I may have a URL such as www.example.com/people/michael.phelps

URLs with the dot generate a 404. My routing is fine. If I pass in michaelphelps, without the dot, then everything works. If I add the dot I get a 404 error. The sample site is running on Windows 7 with IIS8 Express. URLScan is not running.

I tried adding the following to my web.config:

<security>
<requestFiltering allowDoubleEscaping="true"/>
</security>


This is a MVC4 project but I don't think that's relevant. My routing works fine and the parameters I expect are there, until they include a dot.

What do I need to configure so I can have dots in my URL?

• Can't believe I spent so much time on this one. The URL works fine if I add a trailing slash. For example, www.example.com/people/michael.phelps/ however without the trailing slash IIS throws a 404 error. – Mark Jul 30 '12 at 21:51
• Mark - that is because without the trailing slash, IIS thinks it is a file that it should go and find. Adding the slash has the effect of...this is not a real file. Additionally, the configuration option below tells IIS that if it is not a file, try to route it instead. – Tommy Jul 30 '12 at 22:39
• I'm having the same problem after I updated my project to mvc 4 + asp.net 4.5. – Tadeu Maia Aug 21 '12 at 22:57
• As a work around I'm using IIS Rewrite to add the trailing slash to my URLs. – Mark Aug 21 '12 at 23:11
• This doesn't work for me. The URL works fine with "." within the URL but when it is at the very end it gives an error – Arcadian Feb 27 '15 at 14:48