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.
I say that you need to add the Response.TrySkipIisCustomErrors = true;
as:
Server.ClearError();
Response.TrySkipIisCustomErrors = true;
Response.Status = "410 Gone";
Response.StatusCode = 410;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With