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

N

none

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
 
G

George

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.
 
S

Steven Cheng [MSFT]

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:
(e-mail address removed).

==================================================
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.

--------------------
 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top