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
[HTML]View Plaincopyprint?
- <%@ 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" >
- An error has occurred, please contact the Administrator
- <!--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
[HTML]View Plaincopyprint?
- <%@ 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 = "Microsoft 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
[CSharp]View Plaincopyprint?
- 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)
- {
- Spwebapplication webApp = properties. Feature.parent as spwebapplication;
- if (null! = webApp)
- {
- Webapp.updatemappedpage (SPWebApplication.SPCustomPage.Error, null);
- Webapp.updatemappedpage (SPWebApplication.SPCustomPage.Signout, null);
- Webapp.update (true);
- }
- }
SharePoint Development-Custom page (Error page, logout page)