2

I'm using IIS 7.5 and my goal to allow this one json file as browsable however I don't want any other json files to be accessible when navigating through the URL, therefore the typical IIS 404 page would appear.

I'm aware that you can allow all json files using the MIME Types feature per site or virtual directory, but I can't seem to figure out how to allow just the one file.

1 Answer 1

3

In the web.config for your site, use something like this:

<location path="bar/foo.json">
  <system.webServer>
    <staticContent>
      <clear/>
      <mimeMap fileExtension=".json" mimeType="application/json" />
    </staticContent>
  </system.webServer>
</location>

directly under the <configuration> node.

Assuming you have not added a json mime type anywhere else, this should work. You specify this configuration for a specific url/file only.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .