404 pages

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
 
L

lee atkinson

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
 
L

Lloyd Sheen

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
 
J

Juan T. Llibre

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/
=========================
 
J

Juan T. Llibre

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

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

Similar Threads

404 pages 0
HTTP Error 404 1
Question regarding detecting 404 Not Found 2
404 best practice 3
Circumventing the 404 error 2
404 redirects not working 2
CustomErrors for a 404 code 2
Custom Error Pages 2

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top