Session state is not available in this context
From: A.M (IHateSpam_at_sapm123.com)
Date: 03/30/04
- Next message: Ken Cox [Microsoft MVP]: "Re: dont allow multiple login"
- Previous message: Alek Davis: "Re: mimic NT password creation"
- Next in thread: Joe Kaplan \(MVP - ADSI\): "Re: Session state is not available in this context"
- Reply: Joe Kaplan \(MVP - ADSI\): "Re: Session state is not available in this context"
- Reply: [MSFT]: "RE: Session state is not available in this context"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Mon, 29 Mar 2004 21:08:08 -0500
Hi,
Why following code returns exception:
System.Web.HttpException: Session state is not available in this context.
Do i have any other alternative?
Thanks,
Ali
protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{
if (!(HttpContext.Current.User == null))
{
if (HttpContext.Current.User.Identity.AuthenticationType == "Forms" )
{
System.Web.Security.FormsIdentity id;
id =
(System.Web.Security.FormsIdentity)HttpContext.Current.User.Identity;
ArrayList a = (ArrayList)Session["Rolls"];
string[] myRoles = (string[])a.ToArray(typeof(string));
HttpContext.Current.User = new
System.Security.Principal.GenericPrincipal(id,myRoles);
}
}
}
- Next message: Ken Cox [Microsoft MVP]: "Re: dont allow multiple login"
- Previous message: Alek Davis: "Re: mimic NT password creation"
- Next in thread: Joe Kaplan \(MVP - ADSI\): "Re: Session state is not available in this context"
- Reply: Joe Kaplan \(MVP - ADSI\): "Re: Session state is not available in this context"
- Reply: [MSFT]: "RE: Session state is not available in this context"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|