Sharepoint 2010 custom 404 page - asp extension
I'm working on a SharePoint 2010 publishing site. It's replacing a legacy site built using asp.
As it's public facing and anonymous, we're implementing a custom 404 page. Strangely, this is not simple OOTB (like usual), but I did manage to deploy a 404 page and link it up using an event receiver. Perfect, works fine.
So, in testing I tried entering some random pages that didn't exist. It worked fine for .htm, .html, and .aspx. Next, I tried the .asp extension, as this is what all outstanding bookmarks / search engine links will be based from. Instead of the 404 page I got a blank page. I checked it out in Firebug, and the file was actually returned with a 404 header, but it has no content. Not good.
Anyone solved this problem? Is a custom http module the only way to go here??
As an aside, another strange behaviour is if you use a unknown extension it will render the html from your 404 page as text! Edit: Also, if you enter an extensionless folder that doesn't exist you get this same behaviour. Wow, this strange b开发者_如何转开发east continues to vex me.
Thanks.
Update
Looks like a HttpModule is the only way to go here. I have this working - if anyone would like complete code let me know. I'd post it here, but the SO code formatter is mangling things.
web.config entry looks like the following:
<add name="PageNotFoundHttpModule" type="ProjectName.PageNotFoundHttpModule, ProjectName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=fb507da11a891ef3" preCondition="integratedMode" />
SharePoint 2010 ‘Page not found (404)’ page the way it should be
HttpModule sure is the way to go. I followed this page to get it working
http://blog.mastykarz.nl/sharepoint-2010-page-not-found-404/
However, the module only works if I leave out the precondition or else you will run into a blank page.
精彩评论