That's not strictly true, if you specify the 404 page in IIS the
requested page is forwarded in the querystring so in your example if
your setup 404.aspx as a redirect URL, the called page will be
404.asp?404;
http://www.mysite.com/123. This means that you can then
retrieve the requested url in the 404 page with some code similar to the
following. It does with work because we use it!
string RequestedUrl = Request.QueryString.ToString().Replace("404;);
if(RequestedUrl.EndsWith(".aspx") {
// assume this is a request for a folder...
Response.Redirect(RequestedUrl + ".aspx");
} else {
// assume this is an actual 404 error and do the required
processing;
}
This will ultimately result in a request for
http://www.mysite.com/123
being forwarded to
http://www.mysite.com/123.aspx
Matt
http://www.3internet.co.uk
"Emad Ibrahim" <ie***********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
That doesn't work because the 404 page never runs inside the
application. The 404 page is just a redirect in IIS, which means I can't handle any
events in the page, hence I won't be able to load the articles based
on the URL
"matt" <gr************@hitscricket.com> wrote in message
news:ho*********************@wards.force9.net... You cannot map a blank extension to be run by asp.net (i.e in your
httpmodule), so the only way I have found to manage this is to
create a custom 404 page which checks if the 404 is caused by the situation
you describe (in its simplest form just checking if the request ends
with .aspx), you can then redirect to the appropriate page using a
Response.Redirect.
As far as I know this really is the only way around this problem,
although I am aware it isn't the most elegant it does solve the
problem.
HTH
Matt
"Emad Ibrahim" <ie***********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... I need to handle all http requests so that if someone types
something like
http://www.mysite.com/123
then I would load the article 123
I can't get this to work because the app keeps looking for a
folder called 123 and my custom handlers and modules are not getting called.
Although if I type http://www.mysite.com/123.aspx then my custom
handlers are getting called.
How do I fix this?
Thanks.
- Emad