Whenever there is error we get SharePoint 2010 default Error.aspx page. This page is provided by SharePoint without any CSS applied with very simple format. Most of the times we want our custom page to be displayed and in SharePoint 2010 this is possible using the UpdateMappedPage function of Web Application object.
Also this function is also capable to change the other custom mapping pages like
- AccessDenied
- Confirmation
- Error
- Login
- RequestAccess
- Signout
- WebDeleted
This is part of Microsoft.SharePoint.Administration namespace.
The mapping of each page can be changed at any level at point either using PowerShell or using code behind.
I usually prefer to do this in feature activation event having scope “WebApplication”.
Following is code snippet which allows you to do so:
public class MyCustomPagesEventReceiver : SPFeatureReceiver |
To Remove Mapping:
public class MyCustomPagesEventReceiver : SPFeatureReceiver |
No comments:
Post a Comment