Re: How To let all users in a Group to call a method by using an attribute?
- From: "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 12 Jul 2007 10:10:12 -0400
Well, by default, .NET sets the principal of an application to a
GenericPrincipal instance, which has no knowledge of the current
identity/user.
If you want the windows principal to be used across the app domain, then
you need to call the SetPrincipalPolicy on the app domain, passing the
WindowsPrincipal value from the PrincipalPolicy enumeration:
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
This will cause the principal on new threads to be a WindowsPrincipal
instance.
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
"Leon_Amirreza" <amirreza_rahmaty@xxxxxxxxx> wrote in message
news:%231C5jcHxHHA.1168@xxxxxxxxxxxxxxxxxxxxxxx
I Used this and an exception is thrown:
[PrincipalPermissionAttribute(SecurityAction.Demand, Role =
@"BUILTIN\Backup Operators")]
.
- References:
- How To let all users in a Group to call a method by using an attribute?
- From: Leon_Amirreza
- How To let all users in a Group to call a method by using an attribute?
- Prev by Date: Re: Some Interview questions
- Next by Date: Re: Is it possible to convert standard VS project to Test project ?
- Previous by thread: How To let all users in a Group to call a method by using an attribute?
- Next by thread: RSS feed questions
- Index(es):