博客地址 http://blog.csdn.net/foxdave

本文叙述如何自定义SharePoint的固有页面,比较简单,用一句话说就是“做个页面,写一句代码。”

创建SharePoint空解决方案,添加Layouts映射文件夹,添加页面文件error.aspx和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">
出现错误,请联系管理员
<!--自定义错误页面,在此页面写代码-->
</asp:Content>
<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
应用程序页
</asp:Content>
<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea"
runat="server">
我的应用程序页
</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 = "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>

自定义页面的好处是可以处理一些自己实际中需要的操作。

然后添加feature,激活和取消激活事件

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);
}
}

核心就一句话

webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.Error,"/_layouts/SP_MIP/CustomPages/error.aspx");

有这些页面可以自定义

SharePoint开发 - 自定义页面(错误页、登出页)的更多相关文章

  1. sharepoint 2010 自定义页面布局

    在sharepoint开发中经常遇到 自定义网站栏.内容类型,页面布局和模板页也会遇到,遇到机会就相对比较小. 首先新建一个空的sharepoint项目: 1)创建网站兰: 修改SiteColumns ...

  2. .net开发---自定义页面打印区域

    自定义页面打印区域 有3种办法: 办法一:将不需要打印的部位隐藏掉 Examp: <%-- (1)使用css样式,定义一个.noprint的class,将不打印的内容放入这个class内. -- ...

  3. 错误:当你使用id作为sharepoint的自定义页面的查询参数时,总会提示项目不存在!

    No item exists at http://SERVER/SITE/mypage.aspx?ID=1. It may have been deleted or renamed by anothe ...

  4. SharePoint 2010 自定义页面出现“项目可能已被其他用户删除或重命名”问题跟踪

    异常详细信息: Microsoft.SharePoint.SPException: 位置 http://portal/Pages/ShowArticle.aspx?id=19&mylist=8 ...

  5. SharePoint开发 - 自定义导航菜单(一)菜单声明与配置

    博客地址 http://blog.csdn.net/foxdave 本篇描述自定义sharepoint菜单的一种方式,自定义菜单适用于一些门户等需求的网站 自定义的菜单有自己的数据源,可以是数据表,可 ...

  6. SharePoint开发 - 自定义导航菜单(二)母版页的菜单应用

    博客地址 http://blog.csdn.net/foxdave 接上篇点击打开链接 本篇叙述在母版页中应用之前的配置信息生成菜单,主要涉及到母版页的自定义,并应用了第三方控件库DevExpress ...

  7. SharePoint开发 - 自定义导航菜单(三)附其他代码

    博客地址 http://blog.csdn.net/foxdave 接上篇点击打开链接 LeftNavGroupTemplate.cs internal class LeftNavGroupTempl ...

  8. CAS学习笔记五:SpringBoot自动/手动配置方式集成CAS单点登出

    本文目标 基于SpringBoot + Maven 分别使用自动配置与手动配置过滤器方式实现CAS客户端登出及单点登出. 本文基于<CAS学习笔记三:SpringBoot自动/手动配置方式集成C ...

  9. 从零搭建一个IdentityServer——会话管理与登出

    在上一篇文章中我们介绍了单页应用是如何使用IdentityServer完成身份验证的,并且在讲到静默登录以及会话监听的时候都提到会话(Session)这一概念,会话指的是用户与系统之间交互过程,反过来 ...

随机推荐

  1. 转 java List 与ArrasyList 区别

    转 List是一个接口,而ListArray是一个类, ListArray继承并实现了List. 为什么要用 List list = new ArrayList() ,而不用 ArrayList al ...

  2. hiho_1058_combination_lock

    题目大意 给定N个字符,范围为A-Z,编号为1-N,对该字符序列进行M个操作,操作有4中类型: (1)CMD 1 i j X     将[i, j]区间内的字符均变为X (2)CMD 2 i j K  ...

  3. Canu Quick Start(快速使用Canu)

    Canu Quick Start Canu Quick Start PBcR (老版的canu) CA Canu specializes in(专门从事) assembling PacBio or O ...

  4. PS去掉图片上的文字的6种基本方法,动态教程

    1.使用仿制图章工具去除文字这是比较常用的方法.具体的操作是,选取仿制图章工具,按住Alt键,在无文字区域点击相似的色彩或图案采样,然后在文字区域拖动鼠标复制以复盖文字.要注意的是,采样点即为复制的起 ...

  5. html+asp.net上传文件

    type="file" 的name以及id一定要写,并且名字相同 http://niunan.iteye.com/blog/479605 <form id="for ...

  6. C++编译错误cannot have cv-qualifier

    C++编译错误cannot have cv-qualifier 在C++中CV指const和volatile两个关键字.有两种情况不能使用CV限定. 一.非成员函数不能含有CV限定,即const和vo ...

  7. linux笔记:linux常用命令-链接命令

    文件处理命令:ln(创建链接文件) ln -s  源文件 链接文件 需要源文件已经建立,执行链接文件就是执行源文件. 软链接文件的特点: 1.类似于windows中快捷方式的作用: 2.它的文件类型是 ...

  8. iOS应用架构谈 本地持久化方案及动态部署

    转载: iOS应用架构谈 本地持久化方案及动态部署 前言 嗯,你们要的大招.跟着这篇文章一起也发布了CTPersistance和CTJSBridge这两个库,希望大家在实际使用的时候如果遇到问题,就给 ...

  9. spring来了-06-事务控制

    概述 编程式事务控制 自己手动控制事务,就叫做编程式事务控制. Jdbc代码: Conn.setAutoCommite(false);  // 设置手动控制事务 Hibernate代码: Sessio ...

  10. 重启Apache报错apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName ... waiting的解决方法

    启动apache提示 : apache2: Could not reliably determine the server's fully qualified domain name, using 1 ...