博客地址 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. LTIB常用命令2

    LTIB 编译配置选项 根据说明文档,ltib 可以通过以下的命令配置: * <verbatim># ./ltib</verbatim>          安装后第一次运行,采 ...

  2. idea+git

    http://www.cnblogs.com/java-maowei/p/5950930.html

  3. [转] Android OkHttp完全解析 是时候来了解OkHttp了

    http://blog.csdn.net/lmj623565791/article/details/47911083: 本文出自:[张鸿洋的博客] 一.概述 最近在群里听到各种讨论okhttp的话题, ...

  4. refreshLayout 和 滑动控件的冲突解决

    listView.setOnScrollListener(new OnScrollListener() {           @Override     public void onScrollSt ...

  5. OneProxy主从延迟检测

    OneProxy具有主从延迟检测功能,检测方式有两种. 1.通过MySQL本身提供的延迟信息,即在从库中执行show slave status; 查看Seconds_Behind_Master值: 2 ...

  6. Echart 商业级数据图表

    简介 最近工作上用到这个图表库,图表丰富,用起来也很方便.纯javascript,可以流畅得运行在PC和移动设备上,兼容大部分浏览器. 支持折线图(区域图).柱状图(条状图).散点图(气泡图).K线图 ...

  7. 25套用于Web UI设计的免费PSD网页元素模板

    Web 元素是任何网站相关项目都需要的,质量和良好设计的元素对于设计师来说就像宝贝一样.如果您正在为您的网站,博客,Web 应用程序或移动应用程序寻找完美设计的网页元素,那么下面这个列表会是你需要的. ...

  8. Linux查看系统信息(操作系统版本,进程,任务,CPU,内存,磁盘等信息)

    查看操作系统: cat /proc/version   # 内核版本 cat /etc/issue   # 发行版本 head -n 1 /etc/issue uname -a lsb_release ...

  9. HDU-----(1083)Courses(最大匹配)

    Courses Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total S ...

  10. Reverse Nodes in k-Group [LeetCode]

    Problem Description: http://oj.leetcode.com/problems/reverse-nodes-in-k-group/ Basic Idea: Do it lik ...