当我终止会话并通过它的 url 再次返回时,它会显示我的用户名。我已经尝试过session.abandon()
,,session.RemoveAll()
....session.Clear()
帮助将不胜感激。提前致谢。嘿伙计们谢谢。但是当我通过浏览器后退按钮时,代码可以正常工作,但在手动粘贴 URL 时会出现问题。这是代码
public partial class products : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["full_name"] == null)
{
Response.Write("<script language='javascript'>alert('Your are Logged out.Please sign In to Continue.');location='Log-In.aspx'</script>");
}
else
{
Response.Write("hi "+Session["full_name"].ToString());
}
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Session.Remove("full_name");
Session.Abandon();
Response.Write("<script language='javascript'> alert('logged out successfully');location='Log-In.aspx'</script>");
}
}
希望它会有所帮助