Role Administration

Discussion in 'ASP.NET 2.0' started by Rookie, Oct 29, 2006.

  1. You can do the same with Profiles too:



    <profile defaultProvider="MyProfileProvider" enabled="true">
    <providers>
    <remove name="MyProfileProvider"/>
    <add name="MyProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="LocalSqlServer"/>
    </providers>
    <properties>
    <add name="FirstName" />
    <add name="LastName" />
    <add name="Zip" />
    <add name="Theme" />
    </properties>
    </profile></BLOCKQUOTE>
     
  2. How do I add roles? The discoundasp.net Control Panel appears to over ride the standard Website Administration Tool that comes with asp.net 2.0.

    When I tried to use Roles.CreateRole or Roles.GetAllRoles programically I get a database connection error. I am able to use Membership to add users and login so I know my data connection is working.

    An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
     
  3. I was able to fix this within my web.config file. I had to override whatever role provider is set up in the machine.config file. Here is what I did for those interested:

    <roleManager defaultProvider="AspNetSqlRoleProvider2"
    enabled="true"
    cacheRolesInCookie="true"
    cookieName=".ASPXROLES"
    cookiePath="/"
    cookieTimeout="30"
    cookieRequireSSL="false"
    cookieSlidingExpiration="true"
    createPersistentCookie="false"
    cookieProtection="All">
    <providers>
    <remove name="AspNetSqlRoleProvider" />
    <remove name="AspNetWindowsTokenRoleProvider" />
    <add name="AspNetSqlRoleProvider2"
    connectionStringName="MyDataConnName"
    applicationName="/"
    type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </providers>
    </roleManager>

    source: http://help.maximumasp.com/SmarterTicket/Customer/KBArticle.aspx?articleid=878
     
  4. Bruce

    Bruce DiscountASP.NET Staff

    Jim,


    Don't confuse the Control Panel Permission manager with the ASP.NET membership provider. The permission manager actually manipulate NTFS file permission on the server which has nothing to do w/ the ASP.NET membership / role provider.

    See http://kb.discountasp.net/article.aspx?id=10413for more information on how to get the membership provider to work.

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     

Share This Page