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

推荐订阅源

Y
Y Combinator Blog
The GitHub Blog
The GitHub Blog
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
Google DeepMind News
Google DeepMind News
aimingoo的专栏
aimingoo的专栏
Recent Announcements
Recent Announcements
A
About on SuperTechFans
U
Unit 42
MyScale Blog
MyScale Blog
J
Java Code Geeks
博客园_首页
Blog — PlanetScale
Blog — PlanetScale
D
Docker
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 司徒正美
量子位
月光博客
月光博客
G
Google Developers Blog
V
V2EX
博客园 - 聂微东
宝玉的分享
宝玉的分享
IT之家
IT之家
Vercel News
Vercel News

博客园 - rabbler

利用脚本禁止与启动Microsoft SQL Server相关服务 [译]Creating a Stock Widget in ASP.NET MVC Application DOM Document Object properties & DOM Element properties A-Grade Browser By Yahoo asp.net mvc 2.0 validate model asp.net mvc 2.0 Strongly-Typed HTML Helper Javascript code prettifier YUI3学习路线 Asp.net MVC 常用控件 Ubuntu 常用命令收集[菜鸟版] How to use JabRef (BibTeX) with Microsoft Word SQL Server 2008 sp1 集成安装 - rabbler Web Design: CSS Tutorials Bart's PE - rabbler - 博客园 Portal课题的相关词汇 计算机核心期刊一览 IE8 Beta2 安装与卸载之旅 水晶报表的使用 如何提高Asp.net2.0的效率
Using Asp.net Membership and RoleProvider to Build Login ...
rabbler · 2008-11-10 · via 博客园 - rabbler

Long story short, make steps by followed.

Step1: 创建一个新的数据库,目前主流的数据库仍然是SqlServer2005,就使用这个。属性更改为Chinese_RPC_CI_AS.

Note: Chinese_PRC_CS_AI_WS
前半部份:指UNICODE字符集,Chinese_PRC_指针对大陆简体字UNICODE的排序规则。
排序规则的后半部份即后缀 含义:
  _BIN 二进制排序
  _CI(CS) 是否区分大小写,CI不区分,CS区分
  _AI(AS) 是否区分重音,AI不区分,AS区分   
  _KI(KS) 是否区分假名类型,KI不区分,KS区分 
     _WI(WS) 是否区分宽度 WI不区分,WS区分 

Step2: 在Visual Studio的命令行窗口(Command Window)输入aspnet_regsql.exe进入配置aspnet数据库向导,在步骤中指向刚刚创建的数据库。这时候会创建一系列的表,这些表就是与membership相对应的表。

Note:aspnet_regsql.ext工具存放在%WINDIR%\Microsoft.Net\Framework\v2.0.50727\    目录下。

Step3: 在web.config 文件下添加以下内容。

在<configuration>标签里添加

<connectionStrings>
  <add name="testConnectionString" connectionString="Data Source=(local);Initial Catalog=test;Persist Security Info=True;User ID=sa;Password=123456"
   providerName="System.Data.SqlClient" />
</connectionStrings>

在<system.web>标签里添加

<membership defaultProvider="OwnMembershipProvider" >
  <providers>
    <clear />
    <add name="OwnMembershipProvider"
         type="System.Web.Security.SqlMembershipProvider"
         connectionStringName="testConnectionString"
         enablePasswordRetrieval="false"
         enablePasswordReset="true"
         requiresQuestionAndAnswer="true"
         applicationName="test"
         requiresUniqueEmail="true"
         passwordFormat="Hashed"
         maxInvalidPasswordAttempts="5"
         minRequiredPasswordLength="7"
         minRequiredNonalphanumericCharacters="1"
         passwordAttemptWindow="10"
         passwordStrengthRegularExpression="" />
  </providers>     
</membership>

Note: provide相应属性的说明如下:

1

2

Step4: 创建RoleManger。

在<system.web>标签里添加

<roleManager enabled="true" defaultProvider="AspNetSqlRoleProvider">
      <providers>
        <clear />
        <add name="AspNetSqlRoleProvider"
             connectionStringName="testConnectionString"
             applicationName="/"
             type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
      </providers>
    </roleManager>