Varushali,
You can try this:-
call 'getSingleLogin("UserName'")' Method Before Login Process.
void getSingleLogin(string username)
{
if (Cache["_users"] == null)
{
Hashtable ht = new Hashtable();
ht.Add(username, Request.UserHostAddress + "~" + Session.SessionID);
Cache["_users"] = ht;
}
else
{
Hashtable ht = (Hashtable)Cache["_users"];
if (ht.Contains(username))
{
checkUserSession(username);
}
else
{
ht.Add(username, Request.UserHostAddress + "~" + Session.SessionID);
Cache["_users"] = ht;
}
}
}
private void checkUserSession(string userDetails)
{
if (!string.IsNullOrEmpty(userDetails))
{
string str = ((Hashtable)(Cache["_users"]))[userDetails].ToString();
string[] _str = str.Split('~');
if (Request.UserHostAddress.Trim() != _str[0].Trim())
{
Session.Contents.Remove(_str[1]);
}
}
}