Response.RedirectLocation and 404 Page Status

May 1 2009 8:40 AM
Hi All, On my page, if data is not found, i want to redirect my page to some customized page ( saying data not found) with a status code 404 so that google dont crawl it. I am using following code - Response.Clear(); Response.Status = "404 not found."; Response.StatusCode = 404; Response.AddHeader( "Location", "error.htm"); Response.RedirectLocation= "/error.htm"; It sets my page status to 404 but doesnt redirect to "error.htm", however this code works for 301 & 302 redirection. If anyone have idea, please help me out.

Answers (2)