410 Status Displays "The selected page has been deleted"

I have the following code behind an ASP NET web page:

Server.ClearError();
Response.Status = "410 Gone";
Response.StatusCode = 410;

It works on my local host, where the page is NOT redirected, and the user sees the content as he sees fit. However, when I upload to our intermediate site, I see the text "The page you requested has been deleted." instead of my page. I looked through IIS 7 and I cannot find where it redirects this page!?!?

All I want to do is show the expired news article to users of the site, but actually tell Google about my real intention.

+5
source share
1 answer

I am saying that you need to add Response.TrySkipIisCustomErrors = true;as:

Server.ClearError();
Response.TrySkipIisCustomErrors = true;
Response.Status = "410 Gone";
Response.StatusCode = 410;
+5
source

All Articles