环境:Win7+VS2010+SQLServer 2008R2
2,在web.config里面添加以下代码即可:
<?xml version="1.0"?>
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
<providers>
<clear />
<add
name="SqlProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="NorthwindConnectionString"
applicationName="northWind"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
requiresUniqueEmail="true"
passwordFormat="Hashed" />
</providers>
</membership>
<roleManager defaultProvider="SqlProvider"
enabled="true"
cacheRolesInCookie="true"
cookieName=".ASPROLES"
cookieTimeout="30"
cookiePath="/"
cookieRequireSSL="false"
cookieSlidingExpiration="true"
cookieProtection="All" >
<providers>
<add
name="SqlProvider"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="NorthwindConnectionString"
applicationName="northWind" />
</providers>
</roleManager>
</system.web>
<connectionStrings>
<!--<add name="DSN_Northwind" connectionString="Server=.;Database=Northwind;UID=sa;pwd=12345" />-->
<add name="NorthwindConnectionString" connectionString="Server=(local);Initial Catalog=aspnetdb;User ID=sa;Password=12345;"
providerName="System.Data.Sqlclient"/>
</connectionStrings>
</configuration>
3,正常之后:
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。