zoukankan      html  css  js  c++  java
  • SharePoint 2010 启用Form认证并增加用户注册功能

    启用Form认证并增加用户注册的方法见这位仁兄的文章:http://www.cnblogs.com/fanwenxuan/archive/2010/09/18/1830353.html

    或者:http://donalconlon.wordpress.com/2010/02/23/configuring-forms-base-authentication-for-sharepoint-2010-using-iis7/

    本文不再做阐述。

    用上文的方法操作后,用户注册完成必须关闭浏览器重新登录,否则直接点击完成返回首页会报错。

    错误原因无非是asp.net的CreateUserWizard在完成用户创建后会自动使用户登录,但是asp.net的默认登录逻辑跟SP1010的Claim认证机制估计不兼容。

    解决方案:

    1)处理CreateUserWizard的OnCreatedUser事件,增加兼容Claim的认证机制

    反编译了下默认的登录页面代码(_forms/default.aspx),发现Claim的登录机制代码还是蛮多的,其中涉及到众多的internal方法,全部抠出来需要一点时间…

    2)禁止CreateUserWizard自动认证用户,创建完成用户后,转向默认登录页面,让新用户手工登录。本文主要阐述这种方法:

    完整的注册页面代码如下:

    <%@ Assembly Name="Microsoft.SharePoint.IdentityModel, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Assembly Name="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%> 
    <%@ Page Language="C#"  MasterPageFile="~/_layouts/simple.master"   %>
     <%@ Import Namespace="Microsoft.SharePoint.WebControls" %> 
    <%@ 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" %> 
    <%@ Import Namespace="Microsoft.SharePoint" %> 
    <%@ Import Namespace="Microsoft.SharePoint.Administration" %> 
    <%@ Import Namespace="Microsoft.SharePoint.Administration.Claims" %> 
    <%@ Import Namespace="System.IdentityModel.Tokens" %> 
    
    <%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    
    <script language="C#" runat="server">
    
    protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
    {
    Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('register success, please login on using your account');window.location='/';", true);
    }
     
    </script>
    
    <asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
        SignUp
    </asp:Content>
    <asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">
        Sign Up
    </asp:Content>
    <asp:Content ContentPlaceHolderId="PlaceHolderSiteName" runat="server"/>
    <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
    <asp:CreateUserWizard ID="SignUp" runat="server" LoginCreatedUser="false"  oncreateduser="CreateUserWizard1_CreatedUser"
    CreateUserButtonText="Sign Up">
    <TextBoxStyle CssClass="ms-inputuserfield" />
            <WizardSteps>
            <asp:CreateUserWizardStep runat="server" Title="Sign Up"></asp:CreateUserWizardStep>
            <asp:CompleteWizardStep runat="server"></asp:CompleteWizardStep>
            </WizardSteps>
    </asp:CreateUserWizard>
    </asp:Content>

    另:推荐按照FBATools来进行用户管理:http://fbamanagementtool.codeplex.com/
    or
    http://sharepoint2010fba.codeplex.com/
  • 相关阅读:
    VueJS
    Nacos 微服务注册发现配置中心
    精简自己20%的代码(异常的处理)
    lazarus 检测内存泄漏
    winsocket练习一 阻塞与select模型
    js原型链解析
    块元素 父子外边距现象
    行高的继承
    行内元素(文字)垂直平居中
    本地文件播放
  • 原文地址:https://www.cnblogs.com/jianyi0115/p/SharePoint.html
Copyright © 2011-2022 走看看