//////////////// at login page load event
public System.Data.DataTable
dtSessionGlobal = new DataTable();
string clientIp = "";
protected void
Page_Load(object sender, EventArgs e)
{
Session["OptionDB"]
= null;
if
(Cache["UserSessions"] != null)
{
dtSessionGlobal = (DataTable)Cache["UserSessions"];
if
(dtSessionGlobal.Columns.Count == 0)
{
dtSessionGlobal.Columns.Add("UserName");
dtSessionGlobal.Columns.Add("SessionID");
}
}
else
{
dtSessionGlobal.Columns.Add("UserName");
dtSessionGlobal.Columns.Add("SessionID");
Cache["UserSessions"]
= dtSessionGlobal;
}
}
////////////////////////
if (dtSessionGlobal.Rows.Count >
0)
{
System.Data.DataRow[] dr =
dtSessionGlobal.Select(" UserName='"
+ Session["UName"] + "'");
if
(dr.Length > 0)
{
/// write code here which you want
return;
}
}
No comments:
Post a Comment