I am trying to return a HTTP response with 409 status code, content type "application/json" and a json data in the content.
The problem is that at the client level, response.content returns html result. Somehow ASP.Net MVC has de开发者_StackOverflow中文版cided to return a html error message instead of what I intended. I've checked at web.config and 409 is not part of the custom error message. I've checked IIS 7.0 Error Pages section as well for 409 and it is not set there.
I wonder where I can find the default configuration that manage asp.net mvc http error code mechanism.
I am working based on ASP.Net MVC 2.0 and .Net 4.0 on Vista.
Try doing Response.TrySkipIisCustomErrors = true; when sending the response back which will allow to skip the IIS Customer errors. You can read more about it in
http://www.west-wind.com/weblog/posts/2009/Apr/29/IIS-7-Error-Pages-taking-over-500-Errors
精彩评论