Hello
,
the "normal" way is to do a Context.User.IsInRole.
But there is also the PrincipalPermission and PrincipalPermissionAttribute,
which is more common in WinForms/Console libraries - and they rely on Thread.CurrentPrincipal.
ASP.NET supports both styles.
---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com
> It's in the Page Load on an .ascx page. I have so far narrowed it down
> to this, because if I put the code onto the parent .aspx page it works
> fine. It's really weird. Any ideas on why this would be? It's gonna be
> such a pain to have to put this code onto every page. What's the point
> of Web User Controls if they aren't going to work? *Sigh*
>
> The only code in the gloabal.asax is to catch runtime errors in the
> Application Error Sub and send me an email.
>
> In the Web.config I'm impersonating with Windows Authentication.
>
> IIS is set to Windows Authentication, not Anonymous. The virtual
> directory is using its own Application Pool.
>
> And if System.Web.HttpContext.Current*.User.Identity.Name and
> System.Threading.Thread.Curren*tPrincipal.Identity .Name contain the
> same value by default (as I'm reading in the Microsoft documentation),
> why use one over the other?
>
> Thanks,
> Jeremy