1

I want to make an url like http://localhost:1373/Explore/Neighborhood/WA/P.L.U.

Could you please help me out on this?

How to allow dots in url using regex constraint in attribute routing mvc5?

voytek
  • 2,202
  • 3
  • 28
  • 44
  • You could try encoding the periods, but http://stackoverflow.com/questions/3856693/a-url-resource-that-is-a-dot-2e seems to imply that you will have problems with this. – Brendan Green Jun 24 '15 at 05:46

1 Answers1

2

IIS looks at anything with a period as a file, So it will look for a file. as a work around try using IIS Rewrite to add the trailing slash to all URLs. With a trailing slash IIS will route it properly.

<rule name="Add trailing slash" stopProcessing="true">  
<match url="(.*[^/])$" />  
<conditions>  
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />  
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />  
</conditions>  
<action type="Redirect" redirectType="Permanent" url="{R:1}/" />  
</rule> 

Check out this link. http://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/#trailing-slash

Or in MVC you can add RouteTable.Routes.AppendTrailingSlash = true;

pool pro
  • 2,084
  • 12
  • 21