0

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 been sent.

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

1
  • 1
    I would recommend you modifying this behavior. Commented Jun 7, 2010 at 5:57

1 Answer 1

1

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?

Sign up to request clarification or add additional context in comments.

1 Comment

Generally I would agree with you but this was a case where I was using the view from multiple locations in the Controllers and wanted to apply the DRY principal so I only wanted to set the Status Codes in one location.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.