The way this is normally accomplished is via something like:
public class User
{
private int _userId;
public int UserId { get { return _userId; } set { _userId = value;} }
private User(){}
public static User GetCurrentUser()
{
get
{
if (HttContext.Current != null &&
HttpContext.Current.Session["User"] != null)
{
return (User)HttContext.Current.Session["User"];
}
//throw an error? return an anonymous user?
}
}
}
This avoids multithreadng issues, and doesn't have any performance
drawbacks.
Karl
--
http://www.openmymind.net/ http://www.fuelindustries.com/
<ja***@instantecommerce.co.uk> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
Hi
I am considering storing my session variables within one static object
with session scope. The static object will be a class with accessor
functions to get and set the equivalent session variables stored as
member variables. This will allow strong typing. Apart from the
problems of multithreading, are there any performance overheards of
which I should be aware?
Thanks
James