CustomErrors for a 404 code

Discussion in 'ASP .Net' started by David Lozzi, Aug 24, 2007.

  1. David Lozzi

    David Lozzi Guest

    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
    David Lozzi, Aug 24, 2007
    #1
    1. Advertising

  2. In article <>,
    am says...
    > 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).

    --
    Patrick Steele ()
    http://weblogs.asp.net/psteele
    Patrick Steele, Aug 28, 2007
    #2
    1. Advertising

  3. David Lozzi

    David Lozzi Guest

    Yeah, that's what I figured.

    Thanks,

    David Lozzi


    "Patrick Steele" <> wrote in message
    news:...
    > In article <>,
    > am says...
    >> 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).
    >
    > --
    > Patrick Steele ()
    > http://weblogs.asp.net/psteele
    David Lozzi, Aug 28, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. NRao

    customErrors 404

    NRao, Jul 1, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    467
    Bassel Tabbara [MSFT]
    Jul 1, 2003
  2. Jesse Napier

    CustomErrors statusCode 500

    Jesse Napier, Aug 7, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    4,760
    Michal A. Valasek
    Aug 7, 2003
  3. =?Utf-8?B?cmV6YQ==?=

    <customErrors .... not working??

    =?Utf-8?B?cmV6YQ==?=, Feb 18, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    985
    Jim Cheshire [MSFT]
    Feb 18, 2004
  4. Jonathan Folland
    Replies:
    2
    Views:
    1,612
    Jonathan Folland
    Mar 17, 2005
  5. =?Utf-8?B?TWlrZQ==?=

    Read <customErrors> element via VB.NET Code?

    =?Utf-8?B?TWlrZQ==?=, Feb 8, 2007, in forum: ASP .Net
    Replies:
    9
    Views:
    497
    =?Utf-8?B?TWlrZQ==?=
    Feb 8, 2007
Loading...

Share This Page