How to intercept 404 file not found responses

Discuss Sharepoint Installation, Performance Tuning, Management and other MOSS related aspects here.

How to intercept 404 file not found responses

Post by usenet » Fri Jul 03, 2009 8:51 am

Hi,

I would like to redirect a client when SharePoint Services 3.0 or MOSS 2007
give back a 404 status code.

I tried to use ASP.Net and IIS custom error pages but they do not get used -
WSS always returns status 404 and a response text of 404 NOT FOUND.

I added a custom IHttpModule and handled events like PreSendRequestHeaders,
PostRequireRequestState, PostRequestHandlerExecute, PreSendRequestContent
and EndRequest, but the StatusCode in those call backs is always 200, even
if the client gets back 404.

I tried to position my custom handler at the beginning of the httpModules
section and at the end (only one at any time), just in case the execution
sequence of the HttpModules relative to SPRequest is of importance - made no
difference.

It seems that some WSS ISAPI filter is getting in the way, so that
IHttpModules cannot handle this?

What can I do to intercept (and redirect or change the content of) HTTP
error responses?

Regards,
SvenC
More available at Technology Forums
usenet
 
Posts: 80094
Joined: Wed Jun 24, 2009 8:14 am

Re: How to intercept 404 file not found responses

Post by usenet » Fri Jul 03, 2009 6:41 pm

Sven,

Look in the WSS SDK, under the SPWebApplication.FileNotFoundPage property.

From the remarks section:

"Windows SharePoint Services does not support the custom error pages that
are typically used in IIS applications. There can only be one file per
SharePoint Web application, which must be in HTML and cannot contain dynamic
ASP.NET controls."

Unfortunately, it appears that you can't do exactly what you intended.

HTH

"SvenC" wrote in message
news:egM1$t7%23JHA.3732@TK2MSFTNGP02.phx.gbl...
> Hi,
>
> I would like to redirect a client when SharePoint Services 3.0 or MOSS
> 2007 give back a 404 status code.
>
> I tried to use ASP.Net and IIS custom error pages but they do not get
> used - WSS always returns status 404 and a response text of 404 NOT FOUND.
>
> I added a custom IHttpModule and handled events like
> PreSendRequestHeaders, PostRequireRequestState, PostRequestHandlerExecute,
> PreSendRequestContent and EndRequest, but the StatusCode in those call
> backs is always 200, even if the client gets back 404.
>
> I tried to position my custom handler at the beginning of the httpModules
> section and at the end (only one at any time), just in case the execution
> sequence of the HttpModules relative to SPRequest is of importance - made
> no difference.
>
> It seems that some WSS ISAPI filter is getting in the way, so that
> IHttpModules cannot handle this?
>
> What can I do to intercept (and redirect or change the content of) HTTP
> error responses?
>
> Regards,
> SvenC
More available at Technology Forums
usenet
 
Posts: 80094
Joined: Wed Jun 24, 2009 8:14 am

Re: How to intercept 404 file not found responses

Post by usenet » Sat Jul 04, 2009 1:29 pm

Hi Steve,

> Look in the WSS SDK, under the SPWebApplication.FileNotFoundPage property.
>
> From the remarks section:
>
> "Windows SharePoint Services does not support the custom error pages that
> are typically used in IIS applications. There can only be one file per
> SharePoint Web application, which must be in HTML and cannot contain
> dynamic ASP.NET controls."
>
> Unfortunately, it appears that you can't do exactly what you intended.


Too bad.

Could I get around this by writing my own ISAPI filter or extension?

BTW: is this a Microsoft managed news group? I am an MSDN subscriber.

--
SvenC
More available at Technology Forums
usenet
 
Posts: 80094
Joined: Wed Jun 24, 2009 8:14 am

Re: How to intercept 404 file not found responses

Post by usenet » Sat Jul 04, 2009 5:04 pm

Sven,

I honestly don't know how you would implement something like that. You would
essentially have to trap for every possible error, which sounds like a big
job to me.

This is a public forum, so anyone who subscribes to the newsgroup can post
new threads or replies, not just MSDN subscribers. It is hosted by
Microsoft, but I don't see the same level of MS MVP responses that I do on
other MS forums.

HTH

"SvenC" wrote in message
news:eMcjFuK$JHA.1380@TK2MSFTNGP02.phx.gbl...
> Hi Steve,
>[color=green]
>> Look in the WSS SDK, under the SPWebApplication.FileNotFoundPage
>> property.
>>
>> From the remarks section:
>>
>> "Windows SharePoint Services does not support the custom error pages that
>> are typically used in IIS applications. There can only be one file per
>> SharePoint Web application, which must be in HTML and cannot contain
>> dynamic ASP.NET controls."
>>
>> Unfortunately, it appears that you can't do exactly what you intended.

>
> Too bad.
>
> Could I get around this by writing my own ISAPI filter or extension?
>
> BTW: is this a Microsoft managed news group? I am an MSDN subscriber.
>
> --
> SvenC[/color]
More available at Technology Forums
usenet
 
Posts: 80094
Joined: Wed Jun 24, 2009 8:14 am


Return to Sharepoint



Who is online

Users browsing this forum: Google Adsense [Bot] and 3 guests