Click here to Skip to main content
15,882,063 members
Articles / Web Development / IIS
Tip/Trick

Configure IIS to Allow Any File Type to be Downloaded

Rate me:
Please Sign up or sign in to vote.
4.50/5 (3 votes)
15 Feb 2018CPOL1 min read 31.3K   4   2
Configure IIS to allow any file type to be downloaded

Introduction

This tip discusses how to configure IIS to allow any file type to be downloaded.

Background

Many times requirements come into our projects where we want to allow a new file extension to be supported by our IIS.

For example, I want to allow a file with extension ‘.newextension’ to be served by IIS when a user requests a file that contains this file extension.  

Using the Code

For allowing a new file extension, we need to allow a new file extension in MIME types. In our case, I need to add ‘.newextension’ in MIME type.

What are MIME Types?

MIME types basically identify the type of request. If a user requests a file that is not mapped in MIME type, IIS will throw an exception.

‘The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.’

For allowing a new file extension, we need to add a new MIME type. For adding a new MIME type, we need to supply ‘File name extension’ and ’MIME type’. In my case, file name extension will be ‘.newextension and MIME type will be ‘text/plain’ because I just want to view the contents of file.

Once we allow a new file extension, IIS will serve that new file extension.

Request: http://XX.XXX.XX.XX/SampleWeb/test. newextension .

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 5 Pin
Cipherc4-Mar-19 20:01
Cipherc4-Mar-19 20:01 
SuggestionA few points to clarify Pin
MadMyche16-Feb-18 5:20
professionalMadMyche16-Feb-18 5:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.