Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Turn 302 into 404 and general .Net errors

Status
Not open for further replies.

baden100

Programmer
Apr 26, 2006
10
US
First of all, how do I get my generic error page to be called when someone types something like
somepage.htm, somepage.asp, where none of those files exist? If they type somepage.aspx, the page is called. How do I get .Net to call the generic error page in these cases?

Secondly, when there is an error on a page, a 302 redirect is called by .Net which directs the browser to the generic error page. While this is good from a user's perspective, it's NOT GOOD from a search engine perspective.

Why?

Because the search engine sees that a page is redirected to a valid page. So for all pages on your site that throw an error, your generic error page will be indexed!!

How do I get this page to return a 404 error and not a 302 - with no 302 redirect visible to the spider?


Thanks.
 
Check out the custonErrors tag in your web.config file and ann an errors entry for each statusCode.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
That will still cause a redirect code to be rendered, won't it?
 
You can always catch the Http Error in your own handler (global.asax or HttpModule), and if the status code is 404 you can do a Server.Transfer to whatever page you want. This way, the spider indexes the content from the page you transferred to, but for the nonexisting url (if that's what you actaully want). But it sounds like you want spiders to actually get the 404, while real web browsers get the custom error page, right?

[blue]_______________________________________[/blue]
Business Logic:"AND when tweetle beetles battle with paddles in a puddle, they call it a tweetle beetle puddle paddle battle AND..." - Dr. Suess
 
Yeah, that sounds about right. The spiders simply get a redirect to another page, thus, on error, they will index the general error page for, and not read that there's actually a problem!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top