返回的HTTP状态code 409冲突(不ASP.NET MVC的改变) [英] Returning http status code 409 Conflict (without ASP.NET MVC alterations)

查看:3512
本文介绍了返回的HTTP状态code 409冲突(不ASP.NET MVC的改变)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图返回在内容与409状态code一个HTTP响应,内容类型application / JSON和JSON数据。

I am trying to return a HTTP response with 409 status code, content type "application/json" and a json data in the content.

问题是,在客户端级别,response.content返回HTML结果。不知怎的,ASP.Net MVC已经决定返回,而不是我故意的一个HTML错误消息。我在web.config中检查和409不是自定义错误消息的一部分。我检查IIS 7.0的错误页部分,以及409和它未在此处设置。

The problem is that at the client level, response.content returns html result. Somehow ASP.Net MVC has decided 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.

我不知道我在哪里可以找到默认的配置,管理asp.net mvc的HTTP错误code机制。

I wonder where I can find the default configuration that manage asp.net mvc http error code mechanism.

我基于ASP.Net MVC 2.0和.NET 4.0在Vista上工作。

I am working based on ASP.Net MVC 2.0 and .Net 4.0 on Vista.

推荐答案

试着做Response.TrySkipIisCustomErrors = TRUE;发送回响应,这将允许跳过IIS客户的错误时。你可以阅读更多关于它的结果
http://www.west-wind.com/weblog/posts/2009/Apr/29/IIS-7-Error-Pages-taking-over-500-Errors

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

这篇关于返回的HTTP状态code 409冲突(不ASP.NET MVC的改变)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆