⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 masterpage.master.cs

📁 酒店管理 主要实现了基础设施管理(客房管理、客房类型管理)、业务管理(入住、退房、数据库切换) 本系统简单明了,适合初学者学习,采用三层加抽象工厂实现
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using System.Security.Authentication;

public partial class MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Session["signOut"] == null)
                btn_logout.Visible = true;
            else
                btn_logout.Visible = false;
        }
    }
    protected void linkbtn_logout_Click(object sender, EventArgs e)
    {

        HttpCookie cookie = Response.Cookies[FormsAuthentication.FormsCookieName];
        if (cookie != null)
        {
            FormsAuthentication.SignOut();//从浏览器删除 Forms 身份验证票证
        }
        Response.Cookies.Clear();//清空 Cookie 集合中的所有 Cookie
        HttpContext.Current.Response.Cookies[FormsAuthentication.FormsCookieName].Value = null;
        HttpContext.Current.Response.Cookies[FormsAuthentication.FormsCookieName].Expires = DateTime.Now.AddYears(-100);
        //HttpContext.Current.Session.Abandon();//取消当前 HttpContext 对象的会话
        Session.Add("signOut", "true");
        HttpContext.Current.Response.Redirect("~/Login.aspx");
    }
    protected void btn_Register_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Register.aspx");
    }
    protected void btn_Login_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Login.aspx");
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -