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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:28:08+00:00 2026-06-18T02:28:08+00:00

i am using custom role provider for that i made a CustomRoleProvider class and

  • 0

i am using custom role provider for that i made a CustomRoleProvider class and implemented some RoleProvider methods in it, like this

 public class CustomRoleProvider: RoleProvider
 {
 public override void CreateRole(string roleName)
    {
        throw new NotImplementedException();
    }

    public override bool DeleteRole(string roleName, bool throwOnPopulatedRole)
    {
        throw new NotImplementedException();
    }
  }

All the methods are public.but it showing error that

Error 4-Inconsistent accessibility: base class
‘RoleProviderExample.RoleProvider’ is less accessible than class
‘RoleProviderExample.CustomRoleProvider’.

Where I am doing wrong ?

  • 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-18T02:28:09+00:00Added an answer on June 18, 2026 at 2:28 am

    The base class RoleProvider that you are exposing via CustomeRoleProvider is not public.

    If you declare RoleProvider as public the error will go away. You don’t have to give RoleProvider a public constructor.


    Alternatively you could reduce the accesibility of CustomRoleProvider to that of RoleProvider. This may be the most appropriate answer, do you need to expose CustomRoleProvider outside the assembly?


    If RoleProvider is an interface then, by convention, it is misnamed, you could rename it to IRoleProvider. In any case, it is still less accesible then CustomRoleProvider.

    Make it public like this,

    public interface IRoleProvider
    {
        void CreateRole(string roleName);
    
        bool DeleteRole(string roleName, bool throwOnPopulatedRole);
    }
    

    If you don’t specify the accesibility of an interface, class or struct, internal is implied.

    interface members are always public. class and struct members are private unless specified.

    It is good practice to specify, except in the case of interface members which are always public.

    Your implementation could look like this, the override keyword should not be used for interface implementations, unless they are overriding an overridable base class implementation.

    public class CustomRoleProvider : IRoleProvider
    {
        public void CreateRole(string roleName)
        {
            throw new NotImplementedException();
        }
    
        public bool DeleteRole(string roleName, bool throwOnPopulatedRole)
        {
            throw new NotImplementedException();
        }
    }
    

    if you want to explicity implement the interface,

    public class CustomRoleProvider : IRoleProvider
    {
        public void IRoleProvider.CreateRole(string roleName)
        {
            throw new NotImplementedException();
        }
    
        public bool IRoleProvider.DeleteRole(
            string roleName, 
            bool throwOnPopulatedRole)
        {
            throw new NotImplementedException();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a custom role provider (written by another developer) that uses our active
My scenario is this: I have a custom RavenDB membership provider that is implemented
I have a custom role provider that inherits off RoleProvider. In the web app
I'm using custom class that subclass from UILabel. It works fine unless I change
I have created my own custom role provider class SGI_RoleProvider and configured properly. Everything
We're going to be using a custom role provider with WCF. The overridden method
I'm using multiple role providers, the standard SQL provider plus a custom one. Inside
I'm using a custom role provider, which to over simplify gets a person object
I'm using ASP.NET Sitemaps with a custom Role Provider to generate a site Menu
I have just finished creating a custom role provider using LINQ to SQL for

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.