Questions tagged [roleprovider]

Built-in and custom implementations of ASP.NET's Role Provider, as part of Membership functionality in the System.Web.Security namespace.

ASP.NET supports user authentication and authorization through a provider-based model. In support of the authorization providers, there is a Role Provider which supports filtered access to resources by checks against pre-assigned roles.

MSDN Documentation

Managing Authorization Using Roles

Understanding Role Management

Role Management Providers

ASP.NET Security

Questions for this Tag

Questions that should have this tag pertain to use of the default ASP.NET Role Providers (AspNetSqlRoleProvider & AspNetWindowsTokenRoleProvider), as well as questions about extending/overriding the built-in provider.

386 questions
198
votes
7 answers

The Role Manager feature has not been enabled

Got the following ProviderException : The Role Manager feature has not been enabled. So far so good. Is there somewhere a method that can be called to check if the Role Manager has been enabled or not?
gsharp
  • 27,557
  • 22
  • 88
  • 134
52
votes
19 answers

SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified

Well i have a big problem that i'm trying for days to solve but i could not do it, so i need your help. I have a web application in asp.net 4.0 where i implemented custom membership and role providers. When i open the app homepage in it connects to…
31
votes
9 answers

ASP.NET MVC redirect to an access denied page using a custom role provider

I'm creating a custom role provider and I set a Authorize attribute specifying a role in my controller and it's working just fine, like this: [Authorize(Roles="SuperAdmin")] public class SuperAdminController : Controller ... But when an user…
André Miranda
  • 6,420
  • 20
  • 70
  • 94
28
votes
1 answer

Remove asp.net membership and roles provider

For whatever reason, the site I was working on (after a bit of pause) begun screaming about an sql server connection for the asp.net membership. I'm using mysql without asp.net membership so it was weird. However just to be sure I've decided to…
MikeSW
  • 16,140
  • 3
  • 39
  • 53
21
votes
1 answer

Reference current RoleProvider instance?

When inside an ASP.NET page, module or handler with an HttpContext present, how do I get a reference to the current RoleProvider instance? It's the provider used for authorization when the IPrincipal.IsInRole(..) method is called. By default, or…
John K
  • 28,441
  • 31
  • 139
  • 229
19
votes
2 answers

Specifying Roles in web.config of an asp.net MVC application

I am creating an MVC application with forms auth. I am authenticating against active directory and so have created a custom RoleProvider. My application is only concerned with a small set of roles which up until now I have been defining in the…
James
  • 1,979
  • 5
  • 24
  • 52
16
votes
1 answer

Refresh current user's role when changed in ASP.NET identity framework?

Using VS 2013, standard MVC template, and the Identity provider framework The user is logged in, and I have: //.... UserManager.AddToRole(User.Identity.GetUserId(), "Members"); # Line X RedirectToAction("Index", "Members"); And the Members…
Old Geezer
  • 14,854
  • 31
  • 111
  • 198
16
votes
1 answer

Authorization using active directory role provider MVC4

I'm building a MVC4 application for internal use in a corporate enviroment. I use windows authentication, which works fine, but I'm having troubles using Active Directory groups as roles for authorization. My Web.config looks like…
Roberto
  • 567
  • 1
  • 3
  • 10
13
votes
3 answers

MVC4: UserIsInRole - Unable to connect to SQL Server database

Breaking my head around with this, yesterday it worked fine and today it seems to be broken: This line is generating the error: @if (Roles.IsUserInRole(HttpContext.Current.User.Identity.Name, "Admin")) the error is: Unable to connect to SQL Server…
Chen
  • 611
  • 1
  • 6
  • 18
12
votes
1 answer

How to setup OWIN with Windows authentication and a custom role provider

In MVC4 I enabled in the web.config and created a custom role provider which then would automatically wrap the WindowsIdentity with a RolePrincipal for you. Worked like a charm. How would you do this in MVC5 using…
batkuip
  • 1,480
  • 3
  • 15
  • 25
11
votes
2 answers

IsUserInRole calls GetRolesForUser?

When I implement the RoleProvider class and call Roles.IsUserInRole(string username, string roleName), code execution first goes to the method 'GetRolesForUser(string username)'. Why is this? I don't want to iterate all roles when I am just…
Josh
  • 10,352
  • 12
  • 58
  • 109
9
votes
2 answers

Using Ninject with a Custom Role provider in an MVC3 app

I'm trying to use a custom role provider in an MVC3 app. I've already got the membership provider working ok using Ninject but can't seem to get the role provider working. The Membership provider doesn't require a parameterless constructor but…
Matt
  • 5,573
  • 4
  • 33
  • 37
9
votes
3 answers

is there an authorizeattribute equivalent to just standard web forms (not MVC) for .net

I'm working on a project that will use windows role providers and I want to limit functionality to certain AD groups. With MVC, I could use an AuthorizeAttribute above my action methods and redirect accordingly. Is there something similar I can do…
Blair Jones
  • 311
  • 3
  • 4
  • 8
9
votes
5 answers

attribute for .net MVC controller action method

Essentially I want to show a friendly message when someone is not part of a role listed in my attribute. Currently my application just spits the user back to the log in screen. I've read a few posts that talk about creating a custom attribute that…
Kyle
  • 10,839
  • 17
  • 53
  • 63
9
votes
1 answer

Poor Performance with WindowsTokenRoleProvider

I'm using WindowsTokenRoleProvider to determine Active Directory group membership in an ASP.NET web application. My problem is that performance is not good, especially when a user is in many groups. As an example, I am in 253(!) groups, and…
Cocowalla
  • 13,822
  • 6
  • 66
  • 112
1
2 3
25 26