Redirect dead links to default.aspx

F

Frankie

I just acquired a new customer who had an existing ASP classic Web site.
When I took over, I transferred all content to ASPX pages that have
different page names than the prior Web site had. I kept the original domain
name. Of course, google and other search engines indexed the old site. So,
while all links from search results will come to my new ASPX site, the links
will be dead because of the changed page names (and I'm not about to go with
the old page names). So, I'd like to have some way for any/all links to the
site's old page names to result in the visitor being redirected to
default.aspx instead of receiving the "page not found" error.

How can I do this?

Thanks!
 
R

rviray

Couldn't you replace the pointer to the Custom Error page that you
WebSite references
 
F

Frankie

You mean the one specified in Web.config? Yes - I could, but I don't want
*all* exceptions to result in the user seeing default.aspx. Rather, I want
them to get default.aspx *only* when they request a page name that no longer
exists in the site.

Any ideas for getting that to happen?

-F
 
P

Peter Rilling

I have not done this but you might be able to replace the IIS 404 page with
one of your own. Then you could add some kind of redirect command that will
push the browser to default.aspx.

Frankie said:
You mean the one specified in Web.config? Yes - I could, but I don't want
*all* exceptions to result in the user seeing default.aspx. Rather, I want
them to get default.aspx *only* when they request a page name that no
longer exists in the site.

Any ideas for getting that to happen?

-F
 
J

Juan T. Llibre

<customErrors mode="RemoteOnly" defaultRedirect="/error.aspx">
<error statusCode="403" redirect="/denied.aspx" />
<error statusCode="404" redirect="/default.aspx" />
</customErrors>







Frankie said:
You mean the one specified in Web.config? Yes - I could, but I don't want *all*
exceptions to result in the user seeing default.aspx. Rather, I want them to get
default.aspx *only* when they request a page name that no longer exists in the site.

Any ideas for getting that to happen?

-F
 
P

Peter Rilling

This won't work for his case because he siad that the original pages were
legacy ASP pages which is not handled by the aspnet_isapi.dll. Therefore,
IIS will be the one throwing the 404, not ASP.NET.

Juan T. Llibre said:
<customErrors mode="RemoteOnly" defaultRedirect="/error.aspx">
<error statusCode="403" redirect="/denied.aspx" />
<error statusCode="404" redirect="/default.aspx" />
</customErrors>
 
J

Juan T. Llibre

re:
This won't work for his case because he said that the original pages were legacy ASP
pages which is not handled by the aspnet_isapi.dll. Therefore, IIS will be the one
throwing the 404, not ASP.NET.

Peter,

*All* his pages are now *.aspx files.

All he needs to do is map the .asp extension to the aspnet_isapi.dll.
I assumed that would be obvious. Maybe I shouldn't have.

Then, if the web.config entries are included as detailed :

<customErrors mode="RemoteOnly" defaultRedirect="/error.aspx">
<error statusCode="403" redirect="/denied.aspx" />
<error statusCode="404" redirect="/default.aspx" />
</customErrors>

When a request for any *.asp extension file comes in,
aspnet_isapi.dll will redirect to default.aspx.

Thanks for pointing out that I should have included
the reference to mapping the .asp extension to aspnet_isapi.dll.
 
F

Frankie

Yes - perhaps it should have been obvious to *me* too! But it wasn't (kinda
new to this).

Thanks all!

-F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top