jamauss
jamauss

Reputation: 1043

asp.net mvc 3 http 500 server error for .json file

I have a .json file sitting at the root of my site. The name of the file has dots in it (if that matters) and is sitting at a url like http://mysite.com/animated.config.json

When I do a $.getJSON() request for this file, it fails with an HTTP 500 error (internal server error occurred).

Is there a way (like with routes.IgnoreRoute() in global.asax.cs) to just tell the MVC routing to pass the request through and not try to route it? I suspect that's where the issue lies and I'd like to be able to tell MVC to just let any requests for .json files through and not bother routing them. I tried using the same syntax as I did for my favicon.ico file but it didn't work.

I tried this but it didn't work:

routes.Ignore("{resource}.json/{*pathInfo}");

Upvotes: 0

Views: 950

Answers (1)

Richthofen
Richthofen

Reputation: 2086

Are you sure it's MVC's routing that's the problem, and not a MIME type issue with IIS? IIS will only serve certain mime-types by default and if the file has an unknown extension it won't serve it.

Upvotes: 3

Related Questions