Dealing with 404.0 subStatusCode's within the Web.config?

Discussion in 'ASP .Net' started by none, Jul 18, 2008.

  1. none

    none Guest

    All,
    I was wondering is their a way of dealing with subStatusCode's with in the
    webconfig file? I unfortunately don't have access to anything other then
    webconfig and qould perfer to set in code rater then my webhost's control
    panel.

    I've even tried:

    <customErrors mode="On" defaultRedirect="/pages/error.aspx" />

    aspx pages are handled but but I still have a problem if the user types in
    ..asp .htm etc by mistake. Thanks in advance. - CES
    none, Jul 18, 2008
    #1
    1. Advertising

  2. none

    George Guest

    As of right now you can not...

    Problem is that web.config only kicks in when ASP.NET engine is called by
    IIS. And ASP.NET engine is called only when extension (such as .aspx, .asmx,
    ....) associated with ASP.NET is requested.

    So solution is
    Associate all extensions with ASP.NET but be careful cause then my.gif will
    be redirected to ASP.NET instead of sending image to the browser
    Or you can make custom 404 page with .aspx extension (for example
    missing.aspx) . Then IIS will redirect for any 404 request to missing.aspx
    and ASP.NET will kick in and you can do anything you want. But be careful
    again since any missing.gif will be redirected to ASP.NET then.

    George.




    "none" <> wrote in message
    news:...
    > All,
    > I was wondering is their a way of dealing with subStatusCode's with in the
    > webconfig file? I unfortunately don't have access to anything other then
    > webconfig and qould perfer to set in code rater then my webhost's control
    > panel.
    >
    > I've even tried:
    >
    > <customErrors mode="On" defaultRedirect="/pages/error.aspx" />
    >
    > aspx pages are handled but but I still have a problem if the user types in
    > .asp .htm etc by mistake. Thanks in advance. - CES
    George, Jul 19, 2008
    #2
    1. Advertising

  3. I agree with George,

    For the case that user types an incorrect url(invalid one), the ASP.NET
    custom error section will not be able to catch that. It is not due to
    ASP.NET doesn't take care of it, but it doesn't even have a chance to get
    notice of such kind of error. This type of error is at first chance
    detected and handled by the webserver(such as IIS) and ASP.NET runtime
    doesn't even have idea that such kind of error ever happened.

    If you need to handle all such kind of errors, it is necessary to configure
    the IIS metabase for to customize the custom error setting of virtual
    directory.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    .

    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications.
    ==================================================
    This posting is provided "AS IS" with no warranties, and confers no rights.

    --------------------
    >From: "George" <>
    >References: <>
    >In-Reply-To: <>
    >Subject: Re: Dealing with 404.0 subStatusCode's within the Web.config?
    >Date: Fri, 18 Jul 2008 19:59:50 -0400


    >As of right now you can not...
    >
    >Problem is that web.config only kicks in when ASP.NET engine is called by
    >IIS. And ASP.NET engine is called only when extension (such as .aspx,

    ..asmx,
    >...) associated with ASP.NET is requested.
    >
    >So solution is
    >Associate all extensions with ASP.NET but be careful cause then my.gif

    will
    >be redirected to ASP.NET instead of sending image to the browser
    >Or you can make custom 404 page with .aspx extension (for example
    >missing.aspx) . Then IIS will redirect for any 404 request to missing.aspx
    >and ASP.NET will kick in and you can do anything you want. But be careful
    >again since any missing.gif will be redirected to ASP.NET then.
    >
    >George.
    >
    >
    >
    >
    >"none" <> wrote in message
    >news:...
    >> All,
    >> I was wondering is their a way of dealing with subStatusCode's with in

    the
    >> webconfig file? I unfortunately don't have access to anything other then
    >> webconfig and qould perfer to set in code rater then my webhost's

    control
    >> panel.
    >>
    >> I've even tried:
    >>
    >> <customErrors mode="On" defaultRedirect="/pages/error.aspx" />
    >>
    >> aspx pages are handled but but I still have a problem if the user types

    in
    >> .asp .htm etc by mistake. Thanks in advance. - CES

    >
    >
    Steven Cheng [MSFT], Jul 21, 2008
    #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. Jonathan Folland
    Replies:
    2
    Views:
    1,623
    Jonathan Folland
    Mar 17, 2005
  2. Tom Willis
    Replies:
    6
    Views:
    399
    Jorgen Grahn
    Feb 27, 2005
  3. Vlad
    Replies:
    1
    Views:
    832
    Fred Chateau
    Dec 7, 2006
  4. CSharpner
    Replies:
    0
    Views:
    1,018
    CSharpner
    Apr 9, 2007
  5. Ultrus
    Replies:
    3
    Views:
    376
    Stefan Behnel
    Jul 9, 2007
Loading...

Share This Page