Allow Dots in URL (IIS)

IIS, by default, blocks access to any file types it doesn’t recognise. If a dot (.) is in the URL, IIS assumes its a file name and blocks access.

To allow dots in a URL on an IIS site (perhaps for domain names/email addresses/etc. in a MVC routing path) you have to make a couple of changes.

Quick Fix

One simple option is to append a / to the end. This tells IIS its a filepath and not a file.

http://mydnsmanagementsite.com/manage/example.com becomes http://mydnsmanagementsite.com/manage/example.com/.

However, this isn’t ideal: customers who type in the URL manually will probably ignore the leading slash.

Tell IIS to leave you alone

I know what I’m doing! Just send me the data, will you?

Adding the following to web.config will allow http://mydnsmanagementsite.com/manage/example.com to work.

 
    
      
        
      
    
    
    
      
      
      
        
      
    
  

Thanks go to John Hyde and V.B on StackOverflow.

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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s