views:

37

answers:

2

For example on my site i got links to twitter,facebook etc. and the link to the facebook is wrong, so when click the facebook link on my asp.net mvc page. HTTP 404 will be thrown by the browser, so how can this be handled as this wont be caught by Application_Error in the global ascx page.

One way i could think of is tht clicking the link should call a action method where it would ping the url and check if the link is working if works,thn it would redirect.

Is there any other way do this?

+1  A: 

Use Custom errors part in web.config file

Sly
The question is about 404 errors from external sites. The customErrors element is for errors which occur on your web site.
DSO
yep DSO is right
+1  A: 

Periodically validate all your links using a tool like this one. I don't think it really makes sense to do this on demand when the user clicks on the link.

DSO