日期:2014-05-18 浏览次数:20568 次
<div id="welcome"> <asp:Label ID="lblUser" CssClass="roleCss" runat="server" Text=""></asp:Label> <asp:LinkButton ID="lbtnExit" CssClass="exit" Text="退出系统" runat="server" onclick="lbtnExit_Click"></asp:LinkButton> </div> <div id="masterContent"> <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </div>
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["user"] != null) { lblUser.Text = "欢迎您!" + Session["user"].ToString(); } else { lblUser.Text = "您还没有登录!"; lbtnExit.Text = "登录"; } } } /// <summary> /// 退出系统 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lbtnExit_Click(object sender, EventArgs e) { Session.Clear(); //因为有框架,所以用JS跳转 Response.Write("<script>this.parent.location='Login.aspx'</script>");//Login.aspx也位于网站根目录下 }