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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:25:02+00:00 2026-05-13T05:25:02+00:00

I need some help implementing a custom role provider in a asp.net mvc app.

  • 0

I need some help implementing a custom role provider in a asp.net mvc app.

The problem is that I’m getting several errors like:

MyRoleProvider does not implement inherited abstract member 'System.Web.Security.RoleProvider.RoleExists(string)

I get the same error for other methods. However, I do have implementations for those…

My web.config has this:

<roleManager enabled="true" defaultProvider="MyCustomProvider">
  <providers>
     <add name="MyCustomProvider" type="MyRoleProvider" />
  </providers>
</roleManager>

My custom role provider is like this (I ommited a few of the methods):

public class MyRoleProvider : RoleProvider {
        public override string ApplicationName {
                get { throw new NotImplementedException(); }
                set { throw new NotImplementedException(); }
        }
        public override bool RoleExists(string roleName)
        {
                throw new NotImplementedException();
        }
        public override bool IsUserInRole(string username, string roleName)
                return true;
        }
}

What am I doing wrong?
(I’m very new to this).

  • 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-13T05:25:02+00:00Added an answer on May 13, 2026 at 5:25 am

    When you create a custom provider, especially under Visual studio, Intellisense will fill in the override members’ content with:

    throw new NotImplementedException();
    

    As you probably know, when inheriting from abstract classes, such as the RoleProvider class, all abstract members of that class must be implemented. Visual studio chooses when you override a member, to by default fill in the above code. Leaving it as is will allow your project to build since it has been implemented, but at runtime you’ll get exceptions because the .net framework will call some of the methods which throw the exception.

    What you need to do is remove the throw statement and implement the logic of that method or property. So for IsUserInRole method, you would check whatever user store you’re using (SQL database, XML file, etc.) and return true if the user is in a role, false otherwise.

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

Sidebar

Related Questions

I am going round in circles and need some help in implementing a Custom
Need some help with this problem in implementing with XSLT, I had already implemented
I need some help regarding algorithm for randomness. So Problem is. There are 50
I am getting a little confused and need some help please. Take these two
Need some help with a small problem. I'm not too hot on the maths
I need some help from the shell-script gurus out there. I have a .txt
I need some help calculating Pi. I am trying to write a python program
I need some help with jQuery script again :-) Just trying to play with
I need some help ... I'm a bit (read total) n00b when it comes
Hi I need some help with the following scenario in php. I have a

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.