views:

597

answers:

4

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 server set up to test on (I do...but...thats a separate question), but rather currently test on a remote server (where the website is hosted, theres not enough hits where I can get away with testing on a live server).

Any ways...Where do I begin in user role management. I'm not necessarily asking to be given a 30 pg hard description, but more of a summary. My GoDaddy hosting account seems to offer asp.net schemea SQL database set up for user role management, but I have yet to learn how to integrate it into my development.

Any input would be appreciated.

+2  A: 

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.

JoshJordan
The question I have about that is how to "transfer" those role settings to a remote server. Is that role configuration stored in a file?
contactmatt
@ContactMatt - assuming you're using the default SQL Roles Provider, they are stored in the membership database along with your user data. You can export this data from Development to your remote server, or use some tools to set them up.
Zhaph - Ben Duguid
+5  A: 

Here's the first place I'd go:

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

Check out tutorials 9 through 11.

Jay Riggs
+1. Good place to start.
David Stratton
A: 

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>
CRice
A: 

My personal favorite about roles.

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

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

DavRob60