Questions tagged [asp.net-roles]

ASP.NET role management helps you to manage authorization, allowing you to specify which resources various users in your application are allowed to access. Role management lets you group users by assigning them to roles.

226 questions
0
votes
3 answers

Location based Role authentication not working

I am working on a web application with sql membership providers. I have mapped roles for the user in the SQL and the users are assigned to roles correctly. Following code works fine. protected void btnLogin_Click(object sender, EventArgs e) …
wickjon
  • 900
  • 5
  • 14
  • 40
0
votes
1 answer

SQL server error when creating an ActionLink visible to certain roles

What I want to do is to make an ActionLink visible in my page only to certain roles(in this case the "Admin" role). When I add this code to my Layout page... @if (Request.IsAuthenticated) { if (HttpContext.Current.User.IsInRole("Admin")) { …
Stefan P.
  • 331
  • 6
  • 23
0
votes
0 answers

InRole Redirect Page

I have my ID role as technician, so why doesn't User.IsInRole recognize it? public partial class login : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Login1_LoggedIn(object sender,…
Vincent
  • 1
  • 3
0
votes
1 answer

MVC 5 - Roles - AuthorizeAttribute outdated

In my previous post i asked how to check/add user roles, but now i face another problem. Since microsoft moved to the new Identity 2.0, AuthorizeAttribute doesn't work anymore. Is there any substitute filter for the Authorize? EDIT: I've made some…
Leandro Soares
  • 2,902
  • 2
  • 27
  • 39
0
votes
4 answers

Creating Users and Roles in MVC5

I am having some troubles trying to determine where the best place is to create users and roles for an MVC application. Essentially what I want to do is create an admin role and a user role that is already created BEFORE my application gets the the…
bradc14
  • 113
  • 2
  • 10
0
votes
0 answers

ASP.NET MVC - GetRolesForUser(string username)

I'm working with the MVC .NET and I used the WebSecurity layer in order to manage logins and roles. What happens if I have several users with the same "username" in my db and I call the following funciton? Roles.GetRolesForUser(username) Is it…
Matteo Gariglio
  • 482
  • 5
  • 12
0
votes
1 answer

Is there a way to update the User.IsInRole?

I have added my User's Role into the Form authentication, but i wan to be able to change the role when needed. I understand that User.IsInRole returns a boolean to check if it is True or false tallied with the given string/role. like,…
Trent
  • 15
  • 6
0
votes
1 answer

If user lands on protected page then how to redirect based on user role?

I'm using Asp.net Identity. Currently have 7 types or roles in the system. A user can only have 1 role. How can I set the redirect URL based on the user role if that user lands on a protected page that his role doesn't have privilege to? For example…
darren
  • 18,845
  • 17
  • 60
  • 79
0
votes
1 answer

How to filter ICollection on a Role in ASP.NET MVC 5's Identity

I have added 3 roles: Administrators Staff Registered Now I want to display a list of all Registered users. I'm afraid I'm not getting the Identity system, because I am trying to do something like this: Spoiler Alert: not working code var…
0
votes
1 answer

Get full name of users from GetUsersInRole

I'm using SQL Role Provider and to get a list of users within the 'Admin' Role, I'm using the below code: string[] list = Roles.GetUsersInRole("Admin"); This gives me a list of AD username. How do I get the users full name (i.e. First Name + Last…
viv_acious
  • 2,429
  • 9
  • 34
  • 55
0
votes
0 answers

Restoring aspnet stored procedures

I screwed up the stored procs in my SQL database for aspnet authentication/memebership/roles. I ran aspnet_sqlreg tool on a database without knowing that tool is no longer applicable to the aspnet-mvc-5. I ran the tool again to uninstall the tables…
0
votes
1 answer

Count the number of Users in a Role in AspNet.Identity (not Membership)

How to best count the number of users that have a specific role in AspNet.Identity? Looping through the users is slower than molasses. Here is my VERY SLOW code: public static async Task GetNumUsersInRole(this HtmlHelper helper, string…
Ungaro
  • 522
  • 6
  • 15
0
votes
1 answer

Unable to login in webserver to my page using asp.net membership

I have used sqlProvider and asp.net login controls to login to my admin page. I created 4 users in the aspMembershipProvider. I am able to login using the same credentials in the localhost. Now that I have uploaded my website in BigRock domain but…
Guruprasad J Rao
  • 29,410
  • 14
  • 101
  • 200
0
votes
1 answer

Understanding ASP.NET Page Life Cycle and Role-Based Authorization

What I am trying to do Authenticate a user, and redirect them to a page based on their role. My issue The first time entering correct credentials it fails. The user is authenticated, but when evaluating what role they are in, none of the if…
0
votes
1 answer

Implementing my own RoleProvider-and-MembershipProvider

Hello and thanks in advance I'm lost and i don't know whats wrong with my code, and i've been trying to follow a tutorial found at http://www.brianlegg.com/post/2011/05/09/Implementing-your-own-RoleProvider-and-MembershipProvider-in-MVC-3.aspx …