Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8353675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:19:49+00:00 2026-06-09T09:19:49+00:00

I have never worked on authorization in Vb.Net before. So the below question might

  • 0

I have never worked on authorization in Vb.Net before. So the below question might sound stupid for advanced programmers. Please apologize.

I am trying to get the list of the Active Directory Groups of the logged in user. I was told that Roles.GetRolesForUser() is the best way to achieve it. I wrote the below code in my web.config.

<roleManager
  enabled="true"
  cacheRolesInCookie="true" >
</roleManager>

and added the below code in code behind.

Dim userRoles As String() = Roles.GetRolesForUser()

I see the userRoles.length is 0. I verified the user is having more than one active directory groups associated with. Either this is because the configuration which I set in web.config is wrong or this is not the way to get all the active directory groups for this user. Any suggestions are appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T09:19:50+00:00Added an answer on June 9, 2026 at 9:19 am

    Either I am too stupid to understand the Roles.GetRolesForUser() or configuring it is really hard.:)

    I solved this problem using IsInRole() method. I knew the possible ADGroups which would access my app and made that as a configurable item in web.config. Then used String.Split() and then manually checked with HttpContext.Current.User.IsInRole() to verify the user can access the app.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have never worked with web cams in VB.net before. Would anyone be able
I have inherited a SSIS project. I have never worked with SSIS before, and
I have just arrived at new company and have never worked with Qt before,
I have a question. I have never worked with a DotNetNuke setup with SSL
i have never worked with MKMapView or CoreLocation before so I need some help.
I'm fairly new to GWT and have never worked with Java Servlets before. I
I'm currently working with MVC 1.0 and have never worked with AJAX before and
I might be an exception here but I have never worked on a team
I have never worked on programming languages before. I am learning C and unix
I have never worked with json before. I am trying: http://api.worldbank.org//topics?format=JSON and make things

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.