How to allow download of .json file with ASP.NET

前端 未结 6 1161
清酒与你
清酒与你 2020-11-28 20:37

How can I enable the download of *.json files from an old ASP.NET site (IIS6 I am led to believe)?

I am getting a 404 page instead of the JSON file.

Do I nee

6条回答
  •  北海茫月
    2020-11-28 21:36

    Add the JSON MIME type to IIS 6. Follow the directions at MSDN's Configure MIME Types (IIS 6.0).

    • Extension: .json
    • MIME type: application/json

    Don't forget to restart IIS after the change.

    UPDATE: There are easy ways to do this on IIS7 and newer. The op specifically asked for IIS6 help so I'm leaving this answer as-is. But this answer is still getting a lot of traffic even though IIS6 is very old now. Hopefully you're using something newer, so I wanted to mention that if you have a newer IIS7 or newer version see @ProVega's answer below for a simpler solution for those newer versions.

提交回复
热议问题