Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

410 Status Displays "The page you requested was removed"

Tags:

c#

asp.net

iis

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

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

Works a treat on my localhost where the page does NOT redirect and the user sees the content as intended. However when I upload to our staging site I see text "The page you requested was removed." instead of my page. I've looked through IIS 7 and I can't find where it's redirecting this page!?!?

All I want is to display an expired news article to users of the site but crucially let Google know my real intention.

like image 321
Rob Avatar asked Feb 27 '13 16:02

Rob


1 Answers

I say that you need to add the Response.TrySkipIisCustomErrors = true; as:

Server.ClearError();
Response.TrySkipIisCustomErrors = true;
Response.Status = "410 Gone";
Response.StatusCode = 410;
like image 85
Aristos Avatar answered Oct 04 '22 03:10

Aristos