ASP.NET returns incorrect status code even with redirectMode="ResponseRewrite" - by Michal Altair Valasek

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


4
0
Sign in
to vote
ID 507171 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 10/31/2009 7:11:59 PM
Access Restriction Public

Description

This issue is related to issue #273696. Usually, ASP.NET uses redirect when it encounters the error (such as 404, 500). Using the undocumented (at least I was unable to find it in MSDN library) configuration property redirectMode="ResponseRewrite" it may use rewrite instead of redirect. But in such case the page responds with status code 200 instead of the original and expected.
Sign in to post a comment.
Posted by LukePuplett on 10/31/2013 at 8:35 AM
Remember to add the code in code-behind, not in the page markup itself. The headers will have already been sent otherwise.
Posted by Microsoft on 11/18/2009 at 5:02 PM
Thanks for the report. We won't be fixing this issue at this time.

There is a workaround. Change your error page to be Error.aspx instead of Error.htm. In Error.aspx, add the following code:

Response.StatusCode = 404;

Thanks,
The ASP.NET Team
Posted by Microsoft on 11/4/2009 at 12:42 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Thank you
Posted by Microsoft on 11/2/2009 at 12:45 AM
Thank you for your feedback, We are currently reviewing the issue you have submitted.