tags:

views:

123

answers:

1

I've got a PHP-based web app that runs on all kinds of my customer's servers, mostly apache, but sometimes IIS. I'm using a bunch of JSON files for storing image URL data to be loaded by flash elements.

Problem: IIS6+ won't load a .json file, it returns a 404 error because it's not a known mime type (why IIS doesn't recognize .json is beyond me).

I've googled this a bunch, and read this SO post:

http://stackoverflow.com/questions/332988/get-iis6-to-serve-json-files-inc-post-get

But I'm trying to figure out a way to convince IIS to accept the JSON files without the user having to contact their webhost and ask them to make a server-wide change. Is this possible? Is there something sort of like a php_ini setting or some sort of script-based solution to tell IIS that .json's are OK?

If the answer to above is NO, I've read a few places suggesting setting the json file extension to .txt, which I've confirmed works on the IIS7 server I'm troubleshooting on, with no apparent deleterious effects to the flash elements. If I had to, could I write all of the json files as .txt instead? Would there be any down-sides to doing it that way?

A: 

In IIS6, unfortunately, unless you can persuade all your customers to add the .json mime type, you're kind of out of luck.

I don't see any downside of storing the JSON content as say .json.txt however.

On IIS 7, if the hoster has delegated control of the <staticContent> configuration section in <system.webServer> to the site user then you can control this in the web.config file.

Kev
ok, thanks. looks like i'm going to go with the route of serving them all with the extension .txt
Jared Henderson