Pete B [mailto:[EMAIL PROTECTED]] wrote:
> I have assemblies that are accessed from both ASP.NET apps > and from windows services built with DOTNET. > > What should I do in the second case? Ahh... well there's a big difference between the two. The question is, which do your components need: the logical principal or the actual principal? What are your components going to do with the principal information? > In my windows service should I set thread::currentprincipal > equal to my user, then in my assemblies I can check either > HttpContext::User or Thread::CurrentPrincipal for a valid user? Sure, you could do something something like: <codeSnippet language="C#"> HttpContext currentHttpContext = HttpContext.Current; IPrincipal currentPrincipal; if(currentHttpContext != null) { currentPrincipal = currentHttpContext.User; } else { currentPrincipal = Thread.CurrentPrincipal; } ... use principal here ... </codeSnippet> You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.