MOSS2007主要是用于应用于有着域环境的企业内部网络,但是,MOSS2007依然提供了面向Internet的功能。在面向外网的时候,依然使用域环境认证是不可能的,这个时候,使用匿名登录和表单认证就成了首选。

     在参考了Kaneboy的那本《Office SharePoint Server 2007开发入门指南》和网上的一些资料后,我现在分享一下我的经历。(ps:我很奇怪,为什么我照着Kaneboy上的步骤,是会出一些奇怪的错)

  1.      在Central Administration中创建一个新的web applicaiton(我用的是英文版的MOSS,所以这里直接用的都是英文术语)。至于创建一个Web Application就省略了。在创建top-level site collection 的时候选择下面的这个模板类型。

                在MOSS中使用表单认证

   2.     首先在SQL Server2005上创建一个名字为aspnetdb的database,设置不需要修改,为default就可以。

   3.     在运行SQL Server2005的服务器上的C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727路径下,运行aspnet_regsql.exe

                在MOSS中使用表单认证

     一路next之后,来到下面所示,选择相应的server和database,再一路next下去。

                 在MOSS中使用表单认证

      4.用Visual Stuido2005新建一个web site。在web config中<appSettings/>下加入一下的connecting string

 


    <add name="ProviderString" connectionString="Data Source=*****;Initial Catalog=aspnetdb;Integrated Security=True"
        providerName
="System.Data.SqlClient" />
  
</connectionStrings>

     并做以下的一个修改,这里没有加上RoleManager。

 

     

 



    <membership defaultProvider="SqlProvider" userIsOnlineTimeWinow="20">
      
<providers>
        
<remove name="AspNetSqlProvider" />
        
<add connectionStringName="ProviderString" enablePasswordRetrieval="false"
            enablePasswordReset
="true" requiresQuestionAndAnswer="true"
            passwordFormat
="Hashed" applicationName="/" name="SqlProvider"
            type
="System.Web.Security.SqlMembershipProvider" />
      
</providers>
    
</membership>

 

      5.     在新建的site中新建两个user,这里新建了user1和user2

             

               在MOSS中使用表单认证

               在MOSS中使用表单认证

                    在MOSS中使用表单认证

                   在MOSS中使用表单认证

     6.     建好了之后,到C:\Inetpub\wwwroot\wss\VirtualDirectories下面。修改新创建的web application和Central administration的web.config文件。

            


  <connectionStrings>
    
<add name="ProviderString" connectionString="Data Source=psebwtest-sql;Trusted_Connection=True; Initial Catalog=aspnetdb" />
  
</connectionStrings>
  
<system.web>
       
<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="20">
      
<providers>
        
<remove name="AspNetSqlProvider" />
        
<add connectionStringName="ProviderString" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" passwordFormat="Hashed" applicationName="/" name="SqlProvider" type="System.Web.Security.SqlMembershipProvider" />
      
</providers>
    
</membership>

 

     其中</SharePoint>和<System.web>是用来定位何处修改的。

     7.将user1加为site collection administrator

      在MOSS中使用表单认证

     8.     将认证模式从windows 改为Form

      在MOSS中使用表单认证

          

在MOSS中使用表单认证     

     9.     现在你可以去这个网站看看了,一开始是没有匿名登录的,你需要以管理员的身份登录进行修改

        在MOSS中使用表单认证

     10.你可以在红框处修改匿名登录的设置

       在MOSS中使用表单认证

          在MOSS中使用表单认证匿名登录

相关文章: