I came across the situation where I need to replace the default SignOut.aspx page with custom page.
The following feature receiver replaces the default SignOut page with a custom one on activation and resets the SignOut page to the default one on deactivation.
[Guid("d8ed5819-b368-493f-a59c-1167c2a63799")]
public class UpdateDefaultPageEventReceiver : SPFeatureReceiver
{
const string customPage = "_layouts/MyPage/CustomSignOut.aspx";
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
SPWebApplication webApp = properties.Feature.Parent as SPWebApplication;
if (null != webApp)
{
if (!webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.Signout, customPage))
{
//Unable to replace the SignOut page
}
}
}
public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
{
SPWebApplication webApp = properties.Feature.Parent as SPWebApplication;
if (null != webApp)
{
if (!webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.Signout, null))
{
//Unable to reset the SignOut page
}
}
}
}You can also replace other pages which are member of SPWebApplication.SPCustomPage enum. (e.g. AccessDenied.aspx, Confirmation.aspx, Error.aspx, Login.aspx, ReqAcc.aspx, SignOut.aspx etc.)
no code working
ReplyDelete