我做好了一個(gè)單點(diǎn)登陸,但是發(fā)現(xiàn)如果用戶不點(diǎn)擊退出按鈕而是直接關(guān)閉瀏覽器那登陸過(guò)的用戶就不能再登陸系統(tǒng),下面這是我單點(diǎn)登陸所用的代碼Session["sKey"] = txtUserName.Text; string sUser = Convert.ToString(Cache[Session["sKey"].ToString()]); if (sUser == null || sUser == String.Empty) { TimeSpan SessTimeOut = new TimeSpan(0, 0, System.Web.HttpContext.Current.Session.Timeout, 0, 0); HttpContext.Current.Cache.Insert(Session["sKey"].ToString(), Session["sKey"].ToString(), null, DateTime.MaxValue, SessTimeOut, System.Web.Caching.CacheItemPriority.NotRemovable, null); Response.Redirect("Default.aspx"); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "js1", "alert('該帳號(hào)已經(jīng)登陸了該系統(tǒng),不能重新登陸!');", true); return; }勞煩各位大蝦,請(qǐng)問(wèn)當(dāng)用戶登陸之后關(guān)閉瀏覽器怎么釋放掉Cache呢
ASP.NET單點(diǎn)登陸
飲歌長(zhǎng)嘯
2018-08-23 09:06:07