Security Trimming and TreeView Site Navigation in Windows mode authentication

Last post 10-25-2007 8:31 PM by Mehdi6002. 4 replies.

Sort Posts:

  • Security Trimming and TreeView Site Navigation in Windows mode authentication

    10-10-2007, 11:48 AM
    • Loading...
    • Mehdi6002
    • Joined on 01-09-2007, 8:47 AM
    • Ireland
    • Posts 97

    Hi guys,

    I have a custom sitemap provider, which reads and loads the sitemap data from sql database which is then used with a treeview control for site navigation. Roles are also loaded from database for each node, for example

    AdminRole, FeesRole, CommunicationRole for the root node and only AdminRole, FeesRole for Fees node and AdminRole, CommunicationRole for Communications node as the node Roles.
     

    I am using windows authentication and in my web.config I have authentication mode="Windows", and also Impersonate = true as this is an Intranet application.

    I also set SecurityTrimmingEnabled="true" in the web.config.

    but still I see all the treeView nodes when I login as a different user from different role.

    I have the 3 Groups created in windows as AdminRole, FeesRole, CommunicationRole too and each one has a use for testing.

    Aren't the Groups in Windows the same as Roles in Asp.Net...?

    I even tried and change the role Names in database to the full name: MachineName\RoleName (i.e.: MyVirtualPC\FeesRole ) but still didn't work.

    Any help is greatly appreciated.

    Regards,

    Mehdi
     

     

    Mehdi Entezary
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Please click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
  • Re: Security Trimming and TreeView Site Navigation in Windows mode authentication

    10-12-2007, 3:28 AM

    Hi

    If you want to get roles of login user from SQL Server, you will use the default SqlRoleProvider.

    If you want to retrieves role information for a Windows user based on Windows security groups with ASP.NET applications. you will use the WindowsTokenRoleProvider.

    Here is an example about how to use WindowsTokenRoleProvider, Hope it helps

    http://msdn2.microsoft.com/en-us/library/ms998314.aspx

    Best Regards
    XiaoYong Dai
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
  • Re: Security Trimming and TreeView Site Navigation in Windows mode authentication

    10-23-2007, 9:52 AM
    • Loading...
    • Mehdi6002
    • Joined on 01-09-2007, 8:47 AM
    • Ireland
    • Posts 97

    Hello XiaoYong Dai,

    Thanks for your reply. I read that article, and I have to use windows Roles. Windows Groups in ASP.NET as roles. I have already used the configuration described in the link usinf WindowsTokenProvider but still no luck and I wouls see all the nodes in treeview.

    Regards,
    Mehdi
     

    Mehdi Entezary
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Please click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
  • Re: Security Trimming and TreeView Site Navigation in Windows mode authentication

    10-23-2007, 10:35 PM

    Hi

    What is the test result if you use the following code?

    Roles.IsUserInRole(HttpContext.Current.User.Identity.Name, "RoleName");

    Best Regards
    XiaoYong Dai
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
  • Re: Security Trimming and TreeView Site Navigation in Windows mode authentication

    10-25-2007, 8:31 PM
    • Loading...
    • Mehdi6002
    • Joined on 01-09-2007, 8:47 AM
    • Ireland
    • Posts 97

    I get True.

    Mehdi Entezary
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Please click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
Page 1 of 1 (5 items)
Microsoft Communities
Page view counter