404 pages

  • Thread starter Thread starter lee atkinson
  • Start date Start date
L

lee atkinson

Hi Guys

Got a problem with the custom 404 error redirect functionality...

Got this in the web.config -

<customErrors mode="On">
<error statusCode="404" redirect="~/404.aspx" />
</customErrors>


Only seems to work if you spell a page incorrectly eg -

Blah.com/indexxxx.aspx

Doesn't work if you have this - (no page extensions)

Blah.com/sdsdsdsd/ssss

Anybody got a workaround for this ? ... A workaround that doesn¹t involve
tampering with IIS too

Lee
 
I never seem to get an answers for the tricky ones? You 'MVP's seem only to
have smart alex answers for the obvious ones..

L
 
lee atkinson said:
I never seem to get an answers for the tricky ones? You 'MVP's seem only to
have smart alex answers for the obvious ones..

L

Hey Lee,

For someone who is looking for help from those "You 'MVP's seem only to
have smart alex answers for the obvious ones.." you are pretty disrespectful
and I would expect no answer from them.

I don't often reply like this but I and many others have been helped
many times so I feel it necessary to defend this forum as an excellent
method of finding solutions to problems. I can only suggest an apology or I
cannot see anyone helping someone who holds his helpers in such low regard.

LS
 
re:
!> You 'MVP's seem only to have smart alex answers for the obvious ones...

Isn't that just a tad unfair ?
Advice: it's easier to catch answers by posting honey that by posting vinegar.

Here's an article that shows you how to do what you want to do :

http://msmvps.com/blogs/omar/archiv...g-isapi-module-or-iis-6-wildcard-mapping.aspx

All you have to do is forward all HTTP 404 to ASP.NET.

To forward HTTP 404 to ASP.NET ISAPI, you need to
configure IIS to redirect to some .aspx extension on HTTP 404.

Then, in global.asax's BeginRequest event, capture the URL and check
whether it's an extensionless URL request ( see the article's code ).

If it is, URLrewrite the extensionless URL.

Notice that the example simply adds the .aspx extension to the extensionless URL :

HttpContext.Current.RewritePath(requestedFile + ".aspx?" + queryString);

You'll need to rewrite to a custom error page which lets the user know that extensionless requests aren't allowed.

....and please make your requests in a nicer way from now on,. OK ?




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
=========================
 
re:
!> I don't often reply like this but I and many others have been helped
!> many times so I feel it necessary to defend this forum as an excellent
!> method of finding solutions to problems. I can only suggest an apology
!> or I cannot see anyone helping someone who holds his helpers in such low regard.

Thanks, Lloyd.

I made a similar comment...and was tempted not to give him the answer he asked for,
but my good samaritan spirit overpowered me...and I gave him his answer.

I agree that he was out of line and that's it's easier to catch flies with honey than with vinegar.

The concept of "peers helping peers" needs to be understood a bit more by people like Lee.

Nobody ( that includes MVPs and non-MVPs ) gets paid for helping users here.

We all do it because we passionately believe in helping others.
Being nice in return would seem to be only fair play.




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
=========================
 
Back
Top