using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Collections; /// ///CommonPage 的摘要说明 /// public class CommonPage : System.Web.UI.Page { public CommonPage() { // //TODO: 在此处添加构造函数逻辑 // } override protected void OnInit(EventArgs e) { Hashtable hOnline = (Hashtable)Application["Online"]; if (hOnline != null) { if (!hOnline.Contains(Session.SessionID))//同一台PC机多次打开IE登录 { string js = ""; Response.Write(string.Format(js, "帐号已在别处登录 ,你将被强迫下线(请保管好自己的用户密码)!", "../index.aspx")); return; } else { IDictionaryEnumerator idE = hOnline.GetEnumerator(); while (idE.MoveNext()) { if (idE.Key != null && idE.Key.ToString().Equals(Session.SessionID)) { //already login if (idE.Value != null && "alreadyLogin".Equals(idE.Value.ToString())) { hOnline.Remove(Session.SessionID); Application.Lock(); Application["Online"] = hOnline; Application.UnLock(); string js = ""; Response.Write(string.Format(js, "帐号已在别处登录 ,你将被强迫下线(请保管好自己的用户密码)!", "../index.aspx")); return; } break; } } } } } }