Multiple Role Providers with Authorization issue...

Last post 11-28-2006 4:48 AM by raylinder. 3 replies.

Sort Posts:

  • Multiple Role Providers with Authorization issue...

    11-21-2006, 9:05 PM
    • Loading...
    • raylinder
    • Joined on 06-25-2005, 3:28 AM
    • Cornfields, AZ
    • Posts 23

    Ok,

    I'm currently building a webfarm for my girlfriend's start-up. I have 3 SQL databases I'm able to sign-in to using multiple membership providers. Now my situation is when using Authorization/Roles providers. I'm able to program using roles with the same concept used for authenication/membership, but the configuration files (web.config) in the main and sub directories doesn't allow authorization. And the LoginView control isn't display as required either. I know I'm missing a concept or something in this setup, just need to be pointed in the right direction...

    Ray Linder
    Glacsy | Glacsy.com
    raylinder@glacsy.com
  • Re: Multiple Role Providers with Authorization issue...

    11-23-2006, 3:53 PM
    • Loading...
    • raylinder
    • Joined on 06-25-2005, 3:28 AM
    • Cornfields, AZ
    • Posts 23

    This is my web.config setup:

     

    <roleManager enabled="true"
    		 cacheRolesInCookie="true"
    		 cookieName=".MyCookie_Role"
    		 defaultProvider="pdrMyDBOne1"
    		 cookieProtection="All"
    		 cookiePath="/"
    		 cookieSlidingExpiration="true"
    		 createPersistentCookie="false"
    		 cookieTimeout="120">
    	<providers>
    		<clear />
    		<add connectionStringName="MyDBOne1"
    			 applicationName="/"
    			 name="pdrMyDBOne1"
    			 type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
    		<add connectionStringName="MyDBTwo2"
    			 applicationName="/"
    			 name="pdrMyDBTwo2"
    			 type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
    	</providers>
    </roleManager>
    
    I hope this may help. My main focus is just getting the LoginView and the web.config/"security" files in sub-directories to use the setup. If you need more code, let me know. Thanks...

    Ray Linder
    Glacsy | Glacsy.com
    raylinder@glacsy.com
  • Re: Multiple Role Providers with Authorization issue...

    11-28-2006, 3:42 AM
    raylinder:


     but the configuration files (web.config) in the main and sub directories doesn't allow authorization.

    What error did you get when trying to do authorization? Can you post related section from web.config?
    Welcome to my SQL/ASPNET forum for Chinese
    http://51up.org/bbs/forumdisplay.php?fid=38
  • Re: Multiple Role Providers with Authorization issue...

    11-28-2006, 4:48 AM
    • Loading...
    • raylinder
    • Joined on 06-25-2005, 3:28 AM
    • Cornfields, AZ
    • Posts 23
    The error isn't an actual "error" but just reloads the sign-in page which tells me that it's not checking my role correctly. As far as the web.config file:

     
    
    <configuration>
    	<location path="admin">
    		<system.web>
    			<authorization>
    				<allow roles="Administrator, Model" />
    				<deny users="*" />
    			</authorization>
    		</system.web>
    	</location>
    </configuration>
     
    The web.config file is located in a subdirectory (thus not using the main web.config file for many purposes). Also for programmability or "inline/code-behind", I can use this:

     
            SqlRoleProvider srpMainDB1 = (SqlRoleProvider)Roles.Providers["MyRoleProvider1"];
    SqlRoleProvider srpMainDB2 = (SqlRoleProvider)Roles.Providers["MyRoleProvider2"];
     

    and call:

     
    srpMainDB1.IsUserInRole(Page.User.Identity.Name, "Administrator")
     

    Which is the easy part, just need to know what to do using a web.config file and/or a loginview control. Hope this helps...
    Ray Linder
    Glacsy | Glacsy.com
    raylinder@glacsy.com
Page 1 of 1 (4 items)
Microsoft Communities
Page view counter