handling 404 errors on non-ASPX paths

V

versteijn

Hello all,

I know that I can handle 404 errors on ASPX paths, like
www.domain.com/doesnotexist.aspx. But I want to handle 404's like on
www.domain.com/foldername.

Is this possible, and how can I best do this? My application is hosted
by a 3rd party, so I can't do very much of customization on the
serverside.

Hope you can help me.
Thanks very much in advance.

Kind regards,

Freek Versteijn
 
K

KMA

I know what you mean. The worst thing about asp.net is that the rich
functionality is only available for asp.net files. I too am on shared
hosting. Whilst they don't allow you to muck about with IIS (understandably)
maybe they let you define your own error pages. For example my host has
created a folder for all the standard http errors. I am allowed to replace
these files. So I simply create a standard html page that redirects to my
custom404.aspx page. At least then the user is back in my hands. The
drawback (or rather the thing that is missing) is that I don't get any
information about what page the user was trying to access.

So, if they type in the address bar "Dustmastre5000.apsx" I can direct them
to the real page "Dustmaster5000.aspx" but if they type "Dustmaster5000.htm"
then all I can do if display a page with a search box and get them to type
it again. Not ideal, but at about 1$ per month I can't expect more from the
host.
 
V

versteijn

So, if they type in the address bar "Dustmastre5000.apsx" I can direct them
to the real page "Dustmaster5000.aspx" but if they type "Dustmaster5000.htm"
then all I can do if display a page with a search box and get them to type
it again. Not ideal, but at about 1$ per month I can't expect more from the
host.

True. I read here about a solution with a 404 handler though. This
would work for any request of which the target does not match a
physical path, also folders and .html files. Problem is that this
results in a 404 error for each request handled by this 404 handler.

See also: http://www.dotnet247.com/247reference/msgs/11/59939.aspx

Can't think of anything else though. Why should this be so hard?
Any ideas?

Kind regards,

Freek Versteijn
 
J

JIMCO Software

versteijn said:
Can't think of anything else though. Why should this be so hard?
Any ideas?

Why is this so hard? Because you are wanting to execute ASP.NET code when
an HTM request is executed. The only way to do that would be to register a
script map for .htm and .html and point it to aspnet_isapi.dll.

When a request comes into IIS, it determines how to handle that request
based upon, among other things, script mappings. ASP.NET requests are
handled by aspnet_isapi.dll (the ISAPI DLL for ASP.NET which is loaded on
IIS 5 into both the aspnet_wp and inetinfo process) because the file
extension is mapped to that DLL. (On IIS 6, the calls are handled directly
by HttpSys, but the same script mapping scenario applies.)

--
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com

FrontPage add-ins for FrontPage 2000 - 2003
 

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,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top