torsdag den 26. marts 2015

Define extra MIME types in web.config to accecpt fx. .json file like .txt file

If you want to have filename as my.json instead if my.txt file - you will have the problem that server don't know how to response for request for my.json as it don't know the type.
You can define the type (MIME)  in the web.config file.

Example for accept .json to be handlet like .txt file.

<configuration>
........................
   <system.webServer>
   .......................
        <staticContent>
             <mimeMap fileExtension=".json" mimeType="application/json" />
        </staticContent>
   ........................
   </system.webServer>

........................
</configuration>​

Thank Vigan S for the input.

Ingen kommentarer:

Send en kommentar