码迷,mamicode.com
首页 > 其他好文 > 详细

sharepoint 2013基于AD的Form表单登录(二)——form登录页面自定义

时间:2014-04-30 03:14:58      阅读:713      评论:0      收藏:0      [点我收藏+]

标签:com   http   blog   style   class   div   img   code   java   javascript   log   

       配置好了sharepoint 2013基于AD的Form登录,只是成功了第一步,如何自定义登录页呢?特别是不要出现sharepoint2013自带登录页面,每次登录前还需要选择是否是form或者windows验证。

       打开vs2012新建sharepoint 2013 project,在layouts目录下添加application page,页面命名为CustomLogin.aspx。

       前台页面:为避免母版页中其他控件影响,注意继承的是simple.master

        后台页面:继承FormsSignInPage类。

 

mamicode.com,码迷
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Assembly Name="Microsoft.SharePoint.IdentityModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.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=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CustomLogin.aspx.cs" Inherits="ESSE.Sharepoint.Authentication.Layouts.CustomLogin" MasterPageFile="~/_layouts/simple.master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderPageTitle"
    runat="server">
    <SharePoint:EncodedLiteral runat="server"
        EncodeMethod="HtmlEncode" ID="ClaimsFormsPageTitle"
        Visible="false" />
    My Custom Login
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea"
    runat="server">
    <SharePoint:EncodedLiteral runat="server"
        EncodeMethod="HtmlEncode" ID="ClaimsFormsPageTitleInTitleArea"
        Visible="false" />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderSiteName"
    runat="server" />
<asp:Content ID="Content4" ContentPlaceHolderID="PlaceHolderMain"
    runat="server">
    <SharePoint:EncodedLiteral runat="server"
        EncodeMethod="HtmlEncode" ID="ClaimsFormsPageMessage"
        Visible="false" />
    <asp:Login ID="signInControl" FailureText="<%$Resources:wss,login_pageFailureText%>"
        runat="server" Width="100%" DisplayRememberMe="false" />
</asp:Content>
mamicode.com,码迷
mamicode.com,码迷
using System;
using Microsoft.SharePoint.IdentityModel.Pages;

namespace Contoso.SharePoint.Authentication
{
    public partial class Login : FormsSignInPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }
    }
}
后台页面代码

 

 

sharepoint 2013基于AD的Form表单登录(二)——form登录页面自定义,码迷,mamicode.com

sharepoint 2013基于AD的Form表单登录(二)——form登录页面自定义

标签:com   http   blog   style   class   div   img   code   java   javascript   log   

原文地址:http://www.cnblogs.com/lrforever/p/3695769.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!