Questions tagged [genericprincipal]
11 questions
21
votes
3 answers
difference between http.context.user and thread.currentprincipal and when to use them?
I have just recently run into an issue running an asp.net web app under visual studio 2008. I get the error 'type is not resolved for member...customUserPrincipal'. Tracking down various discussion groups it seems that there is an issue with…

yamspog
- 18,173
- 17
- 63
- 95
3
votes
2 answers
Extend System.Web.HttpContext.User
I would like to extend the System.Web.HttpContext.User object (ASP.NET/VB.NET) so that it contains other fields besides just Name. I understand I can create an object that inherits the System.Security.Principal.GenericPrincipal class, but how do I…

Jason
- 51,583
- 38
- 133
- 185
3
votes
2 answers
How can I assign a value to HttpContext.User in ASP.NET MVC?
I write a controller like below:
public class AccountController : Controller
{
public ActionResult Login(/*---*/)
{
GenericIdentity identity = new GenericIdentity("userName");
GenericPrincipal principal = new…

ldp615
- 932
- 1
- 9
- 13
1
vote
0 answers
MVC 5 - Added Role using GenericPrincipal | How to retrieve all roles for the user
I am using MVC 5 + Windows Authentication + Custom Roles, like this
protected void Application_PostAuthenticateRequest(object sender, EventArgs e)
{
List roles = db.GetRoles(HttpContext.Current.User.Identity.Name);
…

Eyedia
- 31
- 5
1
vote
0 answers
HttpContext User value changing on its own?
I'm working on an ASP.Net 2.0 application and am having a strange issue involving the HttpContext User. It appears to be changing on its own when I go to a particular page/directory.
All of our pages inherit from a base page. In that base page's…

larryq
- 15,713
- 38
- 121
- 190
1
vote
1 answer
My.User.IsAuthenticated bug in WPF
I don't know exactly how to explain it, but here is basically how my problem could be reproduced:
Create a WPF Windows Application Project in VB.NET (don't create, just keep reading this, unless you don't believe me...)
Click the Window's header to…

Shimmy Weitzhandler
- 101,809
- 122
- 424
- 632
1
vote
0 answers
How to set GenericPrincipal of threads created automatically C#
I have the code in application like
var principal = new GenericPrincipal(currentIdentity, roles);
Thread.CurrentPrincipal = principal;
but problem is when my application runs some threads are created automatically but there principle is not…

D J
- 6,908
- 13
- 43
- 75
1
vote
2 answers
Set proxy user in a GenericPrincipal, while keeping the old identity, using MVC
I have a site where I allow some users to proxy in as an other user. When they do, they should see the entire site as if they where the user they proxy in as. I do this by changing the current user object
internal static void SetProxyUser(int…

The Jonas Persson
- 1,726
- 1
- 17
- 36
0
votes
0 answers
Generic Principal's getRoles returns empty array
This is the code to create a Principal object.
List roles = new ArrayList();
roles.add(userRole);
this.principal = new GenericPrincipal(username,"***********",roles);
When I printed the principal object, I got [username(userRole,)]
Getting…

Hulk Man
- 153
- 1
- 15
0
votes
1 answer
MSTest Request for principal permission failed
I've looked at the very good content at this thread and it hasn't solved my problem. MSTEST PrincipalPermission
My class:
public class SecurityUsingAttributes
{
[PrincipalPermission(SecurityAction.Demand, Role = "SomeRole")]
public int…

RT.
- 435
- 2
- 9
- 25
0
votes
1 answer
How to apply OR in PrincipalPermission in base and derive class
I have a base class.
[PrincipalPermission(SecurityAction.Demand, Role = "Admin")]
public class Base
{
}
and derived one.
[PrincipalPermission(SecurityAction.Demand, Role = "Developer")]
public class Derived : Base
{
}
I want to let user with…

D J
- 6,908
- 13
- 43
- 75