using System;
using System.Data;
using System.Configuration;
using System.Web;
namespace Common
{
///
/// Summary description for SessionConfig
///
public class StateData
{
#region PROPERTIES
string currentUser;
public string CurrentUser
{
get { return this.currentUser; }
set { this.currentUser = value; }
}
#endregion
private static StateData oInstance;
protected StateData()
{
}
public static StateData Instance
{
get
{
// If called from windows, this would be null. Use Static object then
if (System.Web.HttpContext.Current == null)
{
if (oInstance == null)
{
oInstance = new StateData();
}
return oInstance;
}
if (HttpContext.Current.Session == null || HttpContext.Current.Session["SharedData"] == null)
HttpContext.Current.Session.Add("SharedData", new StateData());
return (StateData)System.Web.HttpContext.Current.Session["SharedData"];
}
}
}
}
No comments:
Post a Comment