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 271453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:09:55+00:00 2026-05-12T00:09:55+00:00

When I run Roles.GetRolesForUser(username) the roles are returned correctly, however if I add a

  • 0

When I run Roles.GetRolesForUser(“username”) the roles are returned correctly, however if I add a user into a role in AD, the result does not show up until I log the user out of their system, and have them log back in.

Is there any way to make the system re-check each time?

  • 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-05-12T00:09:55+00:00Added an answer on May 12, 2026 at 12:09 am

    If you’re using the built-in role provider, there is a setting in the web.config to change this: cacheRolesInCookie. I believe it’s true by default.

    This will of course require a database lookup every time a role lookup happens (if you’re using the db of course), so that may not be a good idea.
    Otherwise, I think you’ll have to write your own provider, which is quite easy. Just create a new class that inherits from RoleProvider, and provide your own implementations. You could handle the caching (or not) in your implementation.

    If you want to see the inner workings of the built-in role providers, download Reflector. It’s a great tool.

    EDIT

    Sorry, I re-read and noticed that you’re using AD. So, you should be fine with just that change to the provider setup in the web.config.

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

Sidebar

Related Questions

I have a standard user/role setup which returns the current user's roles in a
I need to run StyleCop rules check when gatecheckin into tfs2010. But I dont
I have run into a problem where I need to remove certain items from
I'm having a problem trying to run my sql script into oracle using sqlplus.
I have 3 roles: superuser, poweruser and user. I have table data and functions
I have a table containing roles. Many users can be assigned to a role.
Where can I get the DDL to add SQL Roles and Membership to an
I'm trying to create a method to run after any new user is created.
I can't get my any test to run because every user I try to
I have a check_user_access_control before_filter in my ApplicationController that checks the logged user's roles

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.