O
Oscar Thornell
Hi,
I am trying to figure out if I've got it wrong in the following code...
Could I lose the principal in the business layer(not HttpContext aware) if
ASP.NET switches executing thread?
I would presume that if a switch occur the principal/context would be
migrated to the new thread. Am I wrong??
protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{
GenericPrincipal principal = GetGenericPrincipal();
if (principal != null)
{
//Attach the new principal object to the current HttpContext object
Context.User = principal;
// Set the current thread's principal to the HttpContext principal
// This means that we can get the caller's principal in the business
layer
// without requiring knowledge of the HttpContext
System.Threading.Thread.CurrentPrincipal = Context.User;
}
}
Regards
/Oscar
I am trying to figure out if I've got it wrong in the following code...
Could I lose the principal in the business layer(not HttpContext aware) if
ASP.NET switches executing thread?
I would presume that if a switch occur the principal/context would be
migrated to the new thread. Am I wrong??
protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{
GenericPrincipal principal = GetGenericPrincipal();
if (principal != null)
{
//Attach the new principal object to the current HttpContext object
Context.User = principal;
// Set the current thread's principal to the HttpContext principal
// This means that we can get the caller's principal in the business
layer
// without requiring knowledge of the HttpContext
System.Threading.Thread.CurrentPrincipal = Context.User;
}
}
Regards
/Oscar