开发者

Setting Response.StatusCode in View in ASP.NET MVC2

I've just converted a project from MVC1 to MVC2. In the MVC1 project the HTTP status code was being set in some of the views. These views are now generating this exception:

Server cannot set status after HTTP headers have bee开发者_JAVA技巧n sent.

What has changed from MVC1 to MVC2 to cause this and is there any way to fix this?


I would argue that you shouldn't be setting any status codes in the views at all. Is this not the role of the controller at most?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜