78144666 发表于 2015-9-28 12:44:52

Sharepoint v3, 如何设置Forms验证模式

*from link: http://www.bentan.cn/Blog/Lists/Posts/Post.aspx?ID=2
*作者: Ben, benjamine65@hotmail.com
*参考网站: http://www.bentan.cn
*本文使用Windows Sharepoint Services v3 beta 2英文版, 版本号: 12.0.0.4017

众所周知, Sharepoint3在同系列Office 2007 beta2出来的时候已经被推出了. 其中它的新feature包括支持工作流WWF; 支持Blog等Web2网站; 支持RSS订阅; 支持Mobile设备访问等, 无论在性能上还是服务架构上设计都有所提高. 但今天要谈的并不是她这些方面的特性, 而是作者在Sharepoint2梦寐的功能: 支持Forms验证.
1    简介如何安装Sharepoint v3
准备的安装软件:
l          Sharepoint v3 Beta2安装程序
l          (如果是标准安装可以忽略)SQL Server 2005 (作者使用的是EXPRESS版本)
l          WWF Components Beta 2.2
安装环境需求:
   (请参考微软相关网站介绍)
安装步骤:
   A. (如果是标准安装可以忽略)安装SQL Server 2005
   B. 安装WWF Component
   C. 运行Sharepoint v3安装向导step by step直至完成安装(本文是根据Advanced方式安装)

2    配置Sharepoint 3.0 Central Administration网站
2.1   从”管理工具”点击SharePoint 3.0 Central Administration图标进入
2.2   因为第一次运行SharePoint 3.0 Central Administration, 会有提示出现, 这里要按向导完成SharePoint 3.0 Central Administration网站的创建.

* 这里需要注意的,如果你之前安装而又删除了Sharepoint 3.0的其它beta版本, 或者相同的beta版本, 在此向导最后一步的创建SharePoint 3.0 Central Administration网站数据库时会出现the language is not supported on the server的错误. 这是因为删除时将注册表的语言key值给删除了, 要将以下存成.reg文件, 并执行合并到注册表:
Windows Registry Editor Version 5.00

"1033"=""

3    创建Web Application
3.1   进入SharePoint 3.0 Central Administration
3.2       进入Application Management 配置页面
3.3   在SharePoint Web Application Management类下点击Create or extend Web application进行创建Web application. 这一步骤是自动在IIS上创建一个Sharepoint网站目录,或者扩展现有的IIS网站目录

4    设置Forms验证 (两步曲)
4.1   在SharePoint 3.0 Central Administration设置
4.1.1             进入: Central Administration > Application Management > Authentication Providers.
4.1.2             选择你要设置的Web application
4.1.3             providers列表中只有一项membership provider, 这membership provider与ASP.NET 2的membership provider是相同概念. 现在Sharepoint v3默认的membership provider是Windows验证方式, 点击Windows列表链接可以进入设置.
4.1.4             在Edit Authentication页面里, 设置Authentication Type项为Forms;如果允许匿名访问的就在将Anonymous Access项的Enable anonymous access的选项打上钩; Membership Provider Name项目值为: AspNetSqlMembershipProvider, 然后按Save保存设置.
4.2       修改SharePoint 3.0 Central Administration的Web.config. 因为将会在下一步骤创建site collection时要选择site collection的管理员, 所以要配置一下membership的数据库路径: 将
<connectionStrings>
    <remove name="LocalSqlServer" />
    <add name="LocalSqlServer" connectionString="Data Source=数据库服务器地址;database=步骤2创建的Central Administration网站数据库名;uid=登录用户名;pwd=数据库登录密码" />
</connectionStrings>
加在Web.config的<configuration>键下.

* 因为ASP.NET 2中Web.config默认的forms membership provider是AspNetSqlMembershipProvider, 而AspNetSqlMembershipProvider使用的SQL链接地址默认是LocalSqlServer的Connection String.

4.3   IISRESET

5   创建membership数据库和用户(两步曲)
5.1       创建membership数据结构
运行.net framework 2的命令行aspnet_regsql.exe工具来创建membership数据结构
5.2       利用ASP.NET 2程序添加membership用户
用Visual Studio 2005创建一个web site项目, 按4.2步骤的web.config配置方法同样修改这个web site项目的web.config文件; 运行membership管理, 并在security管理里添加用户.

6   创建Sharepoint site collection (两步曲)
到这步骤为止, Sharepoint的环境才算配置完成, 现在就是创建Sharepoint site collection.
6.1   在SharePoint 3.0 Central Administration设置
6.1.1             进入: Central Administration > Application Management > Create Site Collection.
6.1.2             输入相关的Title, Web Site Address, Site Collection Administrator(这里输入5.2步骤里添加到membership管理的用户名)和网站模板
6.1.3             按OK完成
6.2   修改web.config文件 (按4.2步骤的web.config配置方法同样修改当前sharepoint site collection的IIS目录下的web.config文件), OK后再运行一下IISRESET就可以用5.2步骤添加的用户身份进forms验证方式访问此Sharepoint网站了


总结
:
1.      在Sharepoint 3.0里, Central Administration网站也是一个完整的Sharepoint网站, 而且必须要先创建这个Sharepoint网站.
2.      创建sharepoint网站要经两个步骤: 第一要创建扩展web application目录(即IIS网站); 第二步就是创建Sharepoint site collection.
3.      配置forms验证, 因为要在Central Administration网站的web.config文件也要添加membership数据库链接地址.


后话

由于Sharepoint v3的forms验证是ASP.NET 2的AspNetSqlMembershipProvider实现的, 所以用户注册管理等backend管理可以用ASP.NET 2开发实现.
页: [1]
查看完整版本: Sharepoint v3, 如何设置Forms验证模式