CustomErrors for a 404 code

D

David Lozzi

Howdy,

I'm using the following code, asp.net 2.0

<customErrors mode="On" defaultRedirect="oops.aspx">
<error statusCode="403" redirect="notfound.aspx" />
<error statusCode="404" redirect="notfound.aspx" />
<error statusCode="500" redirect="oops.aspx"/>
</customErrors>

A new site rebuild so i want to capture visitors coming in on the old pages.
This doesn't work when the old page is .htm. If I go to a missing .aspx,
like test.aspx, i get the notfound.aspx page and it looks good. If i go to
text.htm I get the generic Page Cannot Be Found error page. Any ideas how I
can get this to work for htm as well?

Thanks,

David Lozzi
 
P

Patrick Steele

Howdy,

I'm using the following code, asp.net 2.0

<customErrors mode="On" defaultRedirect="oops.aspx">
<error statusCode="403" redirect="notfound.aspx" />
<error statusCode="404" redirect="notfound.aspx" />
<error statusCode="500" redirect="oops.aspx"/>
</customErrors>

A new site rebuild so i want to capture visitors coming in on the old pages.
This doesn't work when the old page is .htm. If I go to a missing .aspx,
like test.aspx, i get the notfound.aspx page and it looks good. If i go to
text.htm I get the generic Page Cannot Be Found error page. Any ideas how I
can get this to work for htm as well?

I believe you need to do that directly in IIS (under the properties for
the virtual directory). I don't think you can do that in a web.config
(since, by default, .NET doesn't process HTM files).
 

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

No members online now.

Forum statistics

Threads
473,965
Messages
2,570,148
Members
46,710
Latest member
FredricRen

Latest Threads

Top