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

  • Home
  • SEARCH
  • 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 3844320
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T16:04:15+00:00 2026-05-19T16:04:15+00:00

i implemented custom role and membersip providers. and i have question, when user get

  • 0

i implemented custom role and membersip providers.
and i have question, when user get roles???
i have something like:

if (provider.ValidateUser(model.UserName, model.Password))
            {
            FormsAuthentication.SetAuthCookie(userName, createPersistentCookie);
            }

that works.
But then, in some controller, i use:

if (!User.IsInRole("user"))
            return RedirectToAction("Index", "Home");

and it always false, like user do not have any roles.

so finally, when user gets this roles, and where they are stored????

  • 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-19T16:04:16+00:00Added an answer on May 19, 2026 at 4:04 pm

    The IsInRole method queries the role provider to determine if the currently logged in user has the role. When you create a new ASP.NET MVC application using the default template it uses a SQL role provider meaning that it stores the roles in the database. So when you create a new user you can assign him roles and when you use User.IsInRole it will query the database. Here’s a blog post which describes in more details.

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

Sidebar

Related Questions

I've implemented a custom role provider, and configured it in my web.config file like
I have custom membership and role provider (C#) in my .net 4 (webform based)
My scenario is this: I have a custom RavenDB membership provider that is implemented
I implemented a custom membership provider. I've also implemented my custom AES Encryption/Decryption overriding
I have implemented a custom ActionMapper which obtains the locale from the URI (the
I have implemented a custom view within another activity into a XML layout. The
Some Background to begin: I've implemented a custom MembershipProvider that validates a user from
Possible Duplicate: Symfony2 AJAX Login I have implemented a custom authentication handler service to
I am developing an ASP.NET MVC app with custom membership and role providers. My
I have two entities. User and Role. I am using Devise and CanCan. They

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.