惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LINUX DO - 最新话题
MyScale Blog
MyScale Blog
月光博客
月光博客
S
SegmentFault 最新的问题
C
CERT Recently Published Vulnerability Notes
P
Proofpoint News Feed
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
人人都是产品经理
人人都是产品经理
K
Kaspersky official blog
Forbes - Security
Forbes - Security
宝玉的分享
宝玉的分享
爱范儿
爱范儿
V
Visual Studio Blog
博客园 - 聂微东
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
N
News and Events Feed by Topic
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
The Cloudflare Blog
Attack and Defense Labs
Attack and Defense Labs
美团技术团队
L
LangChain Blog
NISL@THU
NISL@THU
IT之家
IT之家
T
Tor Project blog
云风的 BLOG
云风的 BLOG
Security Latest
Security Latest
Apple Machine Learning Research
Apple Machine Learning Research
Cisco Talos Blog
Cisco Talos Blog
I
InfoQ
Help Net Security
Help Net Security
Engineering at Meta
Engineering at Meta
Know Your Adversary
Know Your Adversary
I
Intezer
Recent Commits to openclaw:main
Recent Commits to openclaw:main
TaoSecurity Blog
TaoSecurity Blog
P
Palo Alto Networks Blog
GbyAI
GbyAI
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
T
The Exploit Database - CXSecurity.com
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - Franky
L
Lohrmann on Cybersecurity
The Register - Security
The Register - Security
W
WeLiveSecurity
Recorded Future
Recorded Future
大猫的无限游戏
大猫的无限游戏
AWS News Blog
AWS News Blog
G
GRAHAM CLULEY

博客园 - 范文轩

Sharepoint中的Feature Stapling功能 SharePoint 2010中的WebProvisioned Event Handler 如何向列表中添加数据值(开发篇补充REST) 如何向列表中添加数据值(开发篇) 如何向列表中添加数据值(管理员篇) 在SharePoint 2010中动态加载Visio Web Part 使用编程的方式来启动SharePoint的工作流 InfoPath 2010调用REST的一个小应用 SharePoint 2010 WSP包部署过程中究竟发生什么? 如何查看SharePoint 2010的CU版本 SharePoint 2010多语言包的安装 在SharePoint 2010中使用Linq时候,请注意特殊字符 自定义ASP.NET WebApplication中调用SharePoint2010的对象 在Infopath 2010中调用Web Service 谈谈SharePoint 2010的客户端对象模型的性能问题 给Document Set里面添加文件夹 给Chart Web Part 添加过滤功能 SharePoint 调查列表的自定义错误页面 Reporting Services 2008 and SharePoint 2010
SharePoint 2010的Form认证的用户注册功能
范文轩 · 2010-09-18 · via 博客园 - 范文轩

说明:

这不是一个完成的方案,过程中还是有很多的用户体验方面的问题需要改进。

前提:

SharePoint 2010 配置好了Form认证。相关的配置方法参考:http://donalconlon.wordpress.com/2010/02/23/configuring-forms-base-authentication-for-sharepoint-2010-using-iis7/

如果要配置 LDAP provider的form认证,这篇文章是个不错的选择:http://blogs.technet.com/b/speschka/archive/2009/11/05/configuring-forms-based-authentication-in-sharepoint-2010.aspx

场景:

SharePoint 2010 配置完Form认证之后,我们需要向SQL数据库中添加新的用户。这一步有什么问题吗?当然有,就是所有的操作都的管理员来做:管理员添加帐号,设置初始密码等等。那么有没有其他的解决方案?用户能不能自定注册网站用户,管理员审批权限呢?

答案是肯定的,要不然也不会写这篇博客了。

方案:

首先我们看一下Form认证的登录页面:

 image

通过URL我们得知,这是一个Application页面,也就是在服务器上真实存在的,路径是:C:\inetpub\wwwroot\wss\VirtualDirectories\<Applicationname>\_forms\default.aspx.

打开页面查看源代码(主要代码):

<asp:login id="signInControl" FailureText="<%$Resources:wss,login_pageFailureText%>" runat="server" width="100%">
    <layouttemplate>
        <asp:label id="FailureText" class="ms-error" runat="server"/>
        <table width="100%">
                         ...    
        </table>
    </layouttemplate>
 </asp:login>

其实就是普通的ASP.Net控件,所以接下来的操作也不太难了。

步骤:

第一步,向这个页面添加一个链接按钮,指向注册页面:

代码以及效果如下:

<asp:login id="signInControl" FailureText="<%$Resources:wss,login_pageFailureText%>" runat="server" width="100%">
    <layouttemplate>
        <asp:label id="FailureText" class="ms-error" runat="server"/>
        <table width="100%">
        ...
        <tr>
        <td colspan="2" align="right"><asp:LinkButton id="RegisterNew" text="Sign Up" runat="server" PostBackUrl="SignUp.aspx" /></td>
        </tr>
        </table>
    </layouttemplate>
 </asp:login>

image

第二步,创建自定义注册页面,并且保存在C:\inetpub\wwwroot\wss\VirtualDirectories\<Applicationname>\_forms文件夹下面。这里主要使用了<asp:CreateUserWizard>控件。这样就不要要而外写逻辑代码了。

 <%@ Page Language="C#" MasterPageFile="~/_layouts/simple.master"       %>
 <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" 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>

第三步,测试。

注册:

image 

image

关闭浏览器,重新登录。(由于方案不完善,如果不关掉浏览器的话,那么会报错)。登录的结果如下:(管理员还没有给该用户添加权限)

image

添加权限:

image

不足:

1.注册页面的样式没有搞定,很丑,很丑;

2.注册完毕后必须要关掉浏览器,然后重新打开浏览器登录,否则报错。