This article describes how to customize the native page of SharePoint, which is simple, in a word, "make a page, write a code." ”
Create a SharePoint empty solution, add the Layouts Mapping folder, add the paging file error.aspx, and signout.aspx.
Error.aspx
<%@ Assembly name= "$SharePoint. project.assemblyfullname$"%><%@ Import namespace= " Microsoft.SharePoint.ApplicationPages "%><%@ Register tagprefix=" SharePoint "namespace=" Microsoft.SharePoint.WebControls "assembly=" Microsoft.SharePoint, version=14.0.0.0, Culture=neutral, publickeytoken=71e9bce111e9429c "%><%@ Register tagprefix=" Utilities "namespace=" Microsoft.SharePoint.Utilities "assembly=" Microsoft.SharePoint, version=14.0.0.0, Culture=neutral, publickeytoken= 71e9bce111e9429c "%><%@ Register tagprefix=" asp "namespace=" System.Web.UI "assembly=" System.Web.Extensions, version=3.5.0.0, Culture=neutral, publickeytoken=31bf3856ad364e35 "%><%@ Import namespace=" Microsoft.SharePoint "%><%@ Assembly name=" Microsoft.Web.CommandUI, version=14.0.0.0, Culture=neutral, publickeytoken=71e9bce111e9429c "%><%@ page language=" C # "autoeventwireup=" true "codebehind=" Error.aspx.cs " inherits= "Custompages.error" dynamicmasterpagefile= "~masterurl/default.maSter "%><asp:content id=" Pagehead "contentplaceholderid=" Placeholderadditionalpagehead "runat=" Server "> </asp:content><asp:content id= "Main" contentplaceholderid= "PlaceHolderMain" runat= "Server" > Error occurred, Please contact admin <!--custom error page, write code on this page--></asp:content><asp:content id= "pagetitle" contentplaceholderid= " Placeholderpagetitle "runat=" Server > Application page </asp:content><asp:content id= "Pagetitleintitlearea" Contentplaceholderid= "Placeholderpagetitleintitlearea" runat= "Server" > My Apps page </asp:Content>
Signout.aspx
<%@ Assembly name= "$SharePoint. project.assemblyfullname$"%><%@ Import namespace= " Microsoft.SharePoint.ApplicationPages "%><%@ Register tagprefix=" SharePoint "namespace=" Microsoft.SharePoint.WebControls "assembly=" Microsoft.SharePoint, version=14.0.0.0, Culture=neutral, publickeytoken=71e9bce111e9429c "%><%@ Register tagprefix=" Utilities "namespace=" Microsoft.SharePoint.Utilities "assembly=" Microsoft.SharePoint, version=14.0.0.0, Culture=neutral, publickeytoken= 71e9bce111e9429c "%><%@ Register tagprefix=" asp "namespace=" System.Web.UI "assembly=" System.Web.Extensions, version=3.5.0.0, Culture=neutral, publickeytoken=31bf3856ad364e35 "%><%@ Import namespace=" Microsoft.SharePoint "%><%@ Assembly name=" Microsoft.Web.CommandUI, version=14.0.0.0, Culture=neutral, publickeytoken=71e9bce111e9429c "%><%@ page language=" C # "autoeventwireup=" true "codebehind=" Signout.aspx.cs " inherits= "Custompages.signout" masterpagefile= "~/_layouts/simple.master"%><asp:content contentplaceholderid=" Placeholderpagetitle "runat=" Server "> <sharepoint: Encodedliteral runat= "Server" text= "<% $Resources:wss,signout_pagetitle%>" encodemethod= ' HtmlEncode '/>< ;/asp:content><asp:content contentplaceholderid= "Placeholderpagetitleintitlearea" runat= "Server" > < Sharepoint:encodedliteral runat= "Server" text= "<% $Resources:wss,signout_pagetitle%>" encodemethod= " HtmlEncode '/></asp:content><asp:content contentplaceholderid= "Placeholderadditionalpagehead" runat= " Server "> <script type=" text/javascript "> Function ULSd63 () {var o = new Object; o.ulsteamname =" Micro Soft SharePoint Foundation "; O.ulsfilename = "signout.aspx"; return o; } function _spbodyonload () {ULSd63:; Window.close (); } </script></asp:content><asp:content contentplaceholderid= "PlaceHolderMain" runat= "Server" > <asp:label id= "Lbpagedescription"text=" <% $Resources:wss,signout_pagedescription%> "runat=" Server "/></asp:content>
The benefit of customizing the page is that you can handle some of the actions that you actually need.
Then add feature, activate and deactivate events
public override void FeatureActivated (Spfeaturereceiverproperties properties) {spwebapplication webApp = Properties. Feature.parent as Spwebapplication; if (null! = webApp) {webapp.updatemappedpage (SPWebApplication.SPCustomPage.Error, "/_layouts/sp _mip/custompages/error.aspx "); Webapp.updatemappedpage (SPWebApplication.SPCustomPage.Signout, "/_layouts/sp_mip/custompages/signout.aspx"); Webapp.update (TRUE); }} public override void FeatureDeactivating (Spfeaturereceiverproperties properties) {SPW Ebapplication webApp = properties. Feature.parent as Spwebapplication; if (null! = webApp) {webapp.updatemappedpage (SPWebApplication.SPCustomPage.Error, NULL); Webapp.updatemappedpage (SPWebApplication.SPCustomPage.Signout, NULL); Webapp.update (TRUE); } }
The core is a word
Webapp.updatemappedpage (SPWebApplication.SPCustomPage.Error, "/_layouts/sp_mip/custompages/error.aspx");
Have these pages to customize
SharePoint Development-Custom page (Error page, logout page)