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

📄 admin.aspx.cs

📁 .net的一个很经典很普通的实例
💻 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;

public partial class admin_admin : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //从cookie中获取身份验证票信息
        string cookieName = FormsAuthentication.FormsCookieName;
        HttpCookie authCookie = Context.Request.Cookies[cookieName];
        if (authCookie != null)
        {
           
            //解密
            FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);
           Label1.Text  = "欢迎您:"+authTicket.Name.ToString();
            Label2.Text= "角色:"+authTicket.UserData.ToString();

        }
        Link1.Attributes.Add("onmouseover","select1();");
        Link2.Attributes.Add("onmouseover", "select2();");
        Link3.Attributes.Add("onmouseover", "select4();");
        Link4.Attributes.Add("onmouseover", "select3();");
     
     
    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        System.Web.Security.FormsAuthentication.SignOut();
        Response.Redirect("/MovieShow/Default.aspx");
    }
}

⌨️ 快捷键说明

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