Asp.net User Roles Management: Where to Begin

后端 未结 4 1995
小蘑菇
小蘑菇 2021-01-05 13:43

I\'m new to User Roles Management. I was reading my Wrox Programming book on asp.net 3.5 user role management...but it was hard to follow along, as I do not have a local se

相关标签:
4条回答
  • 2021-01-05 13:51

    I would open up Visual Studio, create a new ASP.NET Web Application project, and click the "Configure ASP.NET" button on the top-right hand corner of the Solution Explorer. If you navigate to the Security section, you can start creating Users and Roles. The tool basically describes exactly how they work to you.

    0 讨论(0)
  • 2021-01-05 13:55

    You can use SqlRoleProviders and SqlMembershipProviders with the .NET default management, or you can write your own providers.

    http://www.odetocode.com/Articles/427.aspx

    http://msdn.microsoft.com/en-us/library/aa478949.aspx

    Then these are used in conjunction with asp .net forms authentication.

      <authentication mode="Forms">
        <forms name=".ASPXFORMSAUTH" loginUrl="~/Common/Login.aspx" timeout="450" />
      </authentication>
      <authorization>
        <deny users="?" />
        <allow roles="Admin" />
      </authorization>
    

    The configuration of all of this is via the web.config your membership and roles may be similar to this if you use the out of the box aspnetdb.

    <membership defaultProvider="IDTSqlMembershipProvider" userIsOnlineTimeWindow="15">
            <providers>
              <clear />
              <add
                name="IDTSqlMembershipProvider"
                type="System.Web.Security.SqlMembershipProvider"
                connectionStringName="SqlMembershipConnectionString"
                applicationName="ConsumerSynergy"
                enablePasswordRetrieval="false"
                enablePasswordReset="true"
                requiresQuestionAndAnswer="false"
                requiresUniqueEmail="true"
                passwordFormat="Hashed"
                maxInvalidPasswordAttempts="20"
                minRequiredPasswordLength="6"
                minRequiredNonalphanumericCharacters="0" />
            </providers>
          </membership>
    
          <roleManager enabled="true" defaultProvider="IDTSqlRoleProvider" cacheRolesInCookie="true" cookieProtection="All">
            <providers>
              <clear/>
              <add
                name="IDTSqlRoleProvider"
                type="System.Web.Security.SqlRoleProvider"
                connectionStringName="SqlMembershipConnectionString"
                applicationName="ConsumerSynergy"/>
            </providers>
          </roleManager>
    
    0 讨论(0)
  • 2021-01-05 13:57

    My personal favorite about roles.

    Examining ASP.NET's Membership, Roles, and Profile - Part 2

    http://www.4guysfromrolla.com/articles/121405-1.aspx

    0 讨论(0)
  • 2021-01-05 13:58

    Here's the first place I'd go:

    http://www.asp.net/Learn/Security/

    Check out tutorials 9 through 11.

    0 讨论(0)
提交回复
热议问题