ASP.NET membership的XML配置

2009 - 08 - 31
做了一个MEMBERSHIP的测试,先记下来,以备后用!

 <connectionStrings>
    <add name="conn" connectionString="server=.\sqlexpress;uid=sa;pwd=123456;database=test"/>
  </connectionStrings>
 <system.web>
 <!-- 开启角色管理 -->
    <roleManager enabled="true" />
    <!-- membership配置 -->
    <membership userIsOnlineTimeWindow="20">
      <providers>
        <remove name="AspNetSqlMembershipProvider" />
        <add connectionStringName="conn" enablePasswordRetrieval="false"
         enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/"
         requiresUniqueEmail="false" passwordFormat="Clear" maxInvalidPasswordAttempts="5"
         minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0"
         passwordAttemptWindow="10" passwordStrengthRegularExpression=""
         name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </providers>
    </membership>
    <!-- 启用匿名用户-->
    <anonymousIdentification
  enabled="true"
  cookieName=".AnonymousUser"
  cookieTimeout="60"
  cookiePath="/"
  cookieRequireSSL="false"
  cookieSlidingExpiration="true"
  cookieProtection="Validation"
  cookieless="UseCookies"
     />

    <!--  第一个Profile设置,可用中文,推荐英文 -->
    <profile automaticSaveEnabled="true" enabled="true" defaultProvider="MembershipTest">
      <providers>
        <add name="MembershipTest" connectionStringName="conn" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </providers>
      <properties>
        <add name="性别" type="System.String" allowAnonymous="true" />
        <add name="生日" type="System.DateTime" allowAnonymous="true" />
        <add name="星座" type="System.String" allowAnonymous="true" />
        <group name="地址">
          <add name="国家" defaultValue="中国" type="System.String" allowAnonymous="true" />
          <add name="城市" type="System.String" allowAnonymous="true" />
          <add name="邮编" type="System.Int32" allowAnonymous="true" />
        </group>
      </properties>
    </profile>
    <!--
            通过 <authentication> 节可以配置 ASP.NET 用来 
            识别进入用户的
            安全身份验证模式。 
        -->
    <authentication mode="Forms">
      <forms name="myAuthentication" loginUrl="Login.aspx" timeout="60" />
    </authentication>
    <!--
            如果在执行请求的过程中出现未处理的错误,
            则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
            开发人员通过该节可以配置
            要显示的 html 错误页
            以代替错误堆栈跟踪。

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
  </system.web>
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值