31
questions
0
votes
0
answers
802
views
Working around "The trust relationship between the primary domain and the trusted domain failed" when connectivity is lost with IsInRole()?
We had an issue where network connectivity was lost between trusted domains. Even by just using the sample code (with slight updates) on the documentation for WindowsPrincipal.IsInRole (https://learn....
0
votes
2
answers
222
views
User.IsInRole("Admin") returning always false in _Layout.cshtml
In layout.cshtml I am checking whether the current user is an admin or not. If so, then a different menu is shown. However, it is always returning false, even when logging in with an admin.
I am using ...
0
votes
1
answer
2k
views
How to change and apply role for current user in ASP.NET MVC 5
I will first introduce the steps that led me to role authorization problems.
First I add 2 roles in my construstor in HomeController.cs
public HomeController()
{
_db = new ApplicationDbContext();...
-1
votes
2
answers
513
views
My.User.IsInRole is returning false [duplicate]
I was trying to migrate a vb.net application from .net framework 2.0(Visual studio 2008) to .net framework 4.7.0 (Visual studio 2017). Here the problem is, IsInRole method is working fine to check ...
0
votes
1
answer
237
views
My.user.IsInRole always returning false
Currently, I'm working in one migration request, where we need to change the framework from 3.5 to 4.6.2. Here the problem is after changing the framework below method is not showing result as ...
0
votes
1
answer
202
views
My.User.IsInRole() is not working after migrating to 4.6.2 framework in vb.net
Currently i'm working in one migration request, where we need to change the framework from 3.5 to 4.6.2. Here the problem is after changing the framework below method is not showing result as expected....
0
votes
0
answers
292
views
mvc signalr chat - identity user role as prefix
so I'm having troubles using MVC Identity user roles as prefixes in my signalr chat.
This is jQuery inside a script tag in the view.
the view:
var admin = "@User.IsInRole("Administrator");"
// Add ...
3
votes
0
answers
390
views
User.IsInRole only works with AD Group SID (rather than Group Name)
If I only use Windows Authorization, I can easily use User.IsInRole("Web Developers") without issue. But, when I add a SQL Role Provider, User.IsInRole will only return true (for Active Directory ...
7
votes
2
answers
517
views
IsInRole Getting New Security Token
I'm using WindowsPrincipal's IsInRole method to check group memberships in WPF and Winforms apps. I'm generating an identity token which can be for any AD user (not necessarily the user who's actually ...
0
votes
2
answers
1k
views
The User.IsInRole working for Admin but false for other users
In my _Layout.chtml, I want to show menu on the navbar based on the user role. To make it short, I have "Admin" and "User" role. Here is my code in the _Layout.html
<div class="navbar-collapse ...
0
votes
1
answer
253
views
filtering a recordlist User.IsInRole MVC
I have 16 different roles and I'm trying to filter a list according to a users role. I was hoping there was a way to filter this using LINQ but I'm not sure of the best approach for this.
[HttpPost]...
0
votes
0
answers
281
views
User.IsInRole() not working in MVC 4
I know this question is asked many times. I tried all solutions but not getting it worked. I a using MVC4 and using forms authentication. I am not using membership but want to store roles in Forms ...
15
votes
2
answers
20k
views
Usage of User.IsInRole() in a View
In my mvc5 project to disable an action link for unauthorized users i did like this
@if (User.IsInRole("Admin") | User.IsInRole("Manager"))
{
@Html.ActionLink("Add New Record", "...
1
vote
1
answer
574
views
Why @User.IsInRole not working?
I'm using licensed Devart dotConnect product to connect to a PostgreSql database in my ASP.NET MVC5 project. I have problem with Devart Rolemanager.
I installed Dotconnect PostgreSql with folowing ...
-1
votes
1
answer
237
views
Adding roles dynamically to the asp.net role provider
I'm using the Asp.Net Role Provider that contains some roles. I would like to add some other roles that are coming from another database. Is there a way to do some kind of "union" between roles coming ...
1
vote
1
answer
183
views
IsInRole - VB Form Load
I've built an application out of Visual Basic with a login screen and a form. The login screen authenticates with Active Directory. After user authentication, the form loads. On form load, I would ...
3
votes
1
answer
2k
views
Identity 2.0 Custom UserManager/RoleManager vs razor calling User.IsInRole("RoleName")
Questions are below: read through to see what you need to help answer...
I have
VS 2013
MVC 5 with Razor views
Dapper DAL Custom UserManager and UserStore/User : IUser< int >
I build my own ...
10
votes
2
answers
7k
views
User.IsInRole("fake group") results in "The trust relationship between the primary domain and the trusted domain failed"
I have an MVC 3 app, using Windows Authentication with Claims using WIF 4.5.
Access to the application is controlled (currently) via membership in an AD group:
<deny users="?" />
<allow ...
3
votes
3
answers
18k
views
Override the User.IsInRole and [Authorize(Roles = "Admin")] for MVC4 application
I have created a custom role provider for my MVC4 application where I have been successfully able to override CreateRole, GetAllRoles and RoleExists methods and link them to my existing database as ...
4
votes
0
answers
565
views
IsInRole() not checking for nested group membership, what am i missing
Giving correct results for all the groups returned by "whoami /groups" but not for nested groups. For example userA is a member of a group A and group A is a member of Group B then it is returning ...
0
votes
1
answer
2k
views
How to override IsInRole method in MVC 4 Custom Membership?
I'm very new to MVC. I'm doing a Custom Membership asp.net MVC4. Above are the Table & data i have created. I try to override isinrole method but its not working.Below is the sample code & i ...
1
vote
1
answer
1k
views
Check IsInRole without requiring the Authorize attribute?
I have created my own Authorize attribute called Authorise...
Imports System.Security.Principal
<AttributeUsage(AttributeTargets.Method Or AttributeTargets.[Class], Inherited:=True, AllowMultiple:...
1
vote
0
answers
196
views
Verify Group based permissions
I have ASP.NET MVC3 application. We have added Window Based authentication. ON some controller we have to do further authorization.
For example, I want preference page to be view-able for "ABCGroup" ...
0
votes
1
answer
215
views
How not to use a magic string with IsInRole in Silverlight RIA?
I have extended the UserBase class in System.ServiceModel.DomainServices.Server.ApplicationServices in my Silverlight RIA, and yes people still use Silverlight, and I was wondering what the best ...
2
votes
2
answers
922
views
Given the string of the UserName, how can I check if that user IsInRole?
I am attempting to check if a given user has a role before they are fully 'logged in' to the site I am building. Typically I would use the code:
User.IsInRole("CustomRole")
But in this situation ...
2
votes
1
answer
1k
views
WindowsPrincipal.IsInRole not working in IIS 7/Win Server 2K8, but working on IIS 6/Win Server 2K3
Is there some setting or permission in IIS 7/Win Server 2008 that would cause WindowsPrincipal.IsInRole to always return false, when the same code running in IIS 6/Win Server 2003 works? Here's how I'...
1
vote
4
answers
1k
views
How do I find out if an arbitrary DOMAIN\username is in a specific role with C#?
I'm really new to C# so forgive my ignorance. I need to test if a user (DOMAIN\username) is in a particular group, and yes, this includes nested groups.
I have found that WindowsPrincipal.IsInRole() ...
0
votes
1
answer
2k
views
Verify logged in user against exchange distribution list or AD groups in c#
I am trying to verify whether the logged in user exists in a AD group or distribution list. I tried to use WindowsIdentity but that does not give me proper results. If I add a user to the DL and then ...
3
votes
2
answers
11k
views
How does IPrincipal gets its roles?
I need to get know how SiteMapProvider.IsAccessibleToUser() works.
Built-in XmlSiteMapProvider calls HttpContext.User.IsInRole() which uses System.Security.Principal.GenericPrincipal in case of forms ...
0
votes
1
answer
1k
views
How to use IsInRole from ASP.NET Membership in the Library dll
Most Real world web applications have at least one dll library behind them. If we use the ASP.NET membership provider, how can we call the Roles.IsInRole method in the dll?
The possibility of ...
5
votes
1
answer
10k
views
WindowsPrincipal.IsInRole and universal vs. global active directory groups
Does anybody know how to make WindowsPrincipal.IsInRole("domain\role") work with active directory universal groups?
Let's say the current user is a member of a group called Role in a domain called ...