public class SingletonSession
{
// private constructor
private SingletonSession()
{
}
// Gets the current session.
public static SingletonSession Current
{
get
{
SingletonSession session =
(SingletonSession)HttpContext.Current.Session["__SingletonSession__"];
if (session == null)
{
session = new SingletonSession();
HttpContext.Current.Session["__SingletonSession__"] = session;
}
return session;
}
}
// **** add your session properties here, e.g like this:
public Guid UserId { get; set; }
public string UserName { get; set; }
public string AccountNo { get; set; }
public MembershipUser User { get; set; }
}
}
{
// private constructor
private SingletonSession()
{
}
// Gets the current session.
public static SingletonSession Current
{
get
{
SingletonSession session =
(SingletonSession)HttpContext.Current.Session["__SingletonSession__"];
if (session == null)
{
session = new SingletonSession();
HttpContext.Current.Session["__SingletonSession__"] = session;
}
return session;
}
}
// **** add your session properties here, e.g like this:
public Guid UserId { get; set; }
public string UserName { get; set; }
public string AccountNo { get; set; }
public MembershipUser User { get; set; }
}
}
No comments:
Post a Comment