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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirect if link not available

Status
Not open for further replies.

BasicBoy

Programmer
Feb 22, 2008
156
ZA
I need to redirect the browser to a page in my project which might tell them that the link is not available presently - similar to the IE6 error message.

I do not know which route to follow - and I have tried the following two, but I cannot get them to work.

1. I have changed the web.config file to read :

<customErrors mode="On" defaultredirect="notavailable.aspx" />

and

2. I have changed the global.asax file to the following :
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Response.Redirect("unavailable.aspx")
End Sub

Can some one please guide me further ?

Thanks

 
Hi!

You could do it this way:

Code:
<customErrors mode="On" defaultRedirect="notavailable.aspx">
	<error statusCode="404" redirect="unavailable.aspx" />
</customErrors>

and make sure that in IIS you set the 404 code in "Error pages" for Execute URL "/unavailable.aspx".

Hope this helps!

[morning]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top