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

📄 global.asax

📁 本文件为ASP开发的在线播放系统,挺不错的,创建数据需按照说明进行创建,祝你成功!
💻 ASAX
字号:
<%@ Import Namespace="System.Security.Principal" %>

<script language="C#" runat="server">

public class MyIdentity  : IIdentity {
   private string mName;
   public MyIdentity(string InName){
	mName=InName;
   }	
   public  bool IsAuthenticated  {
      get {
         return true;
      }
   }
   public  string Name  {
      get {
         return mName;
      }
   }	
   public  string AuthenticationType  {
      get {
         return "MyType";
      }
   }	
}

public class MyPrincipal : IPrincipal {
	private MyIdentity mIdentity;	
	public  MyPrincipal (WindowsIdentity id){
	   mIdentity = new MyIdentity(id.Name);
	}

	public  IIdentity Identity {
	   get {
	      return mIdentity;
	   }
	}
     	
	public bool IsInRole(string role){
	   if (mIdentity.Name=="CHERRY\\Miles")
	      return true;
	   else
	      return false;   
	}
}

public void WindowsAuthentication_OnAuthenticate(Object Source, WindowsAuthenticationEventArgs  e) {
            
  e.User = new  MyPrincipal(e.Identity);
}




</script>

⌨️ 快捷键说明

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