📄 global.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 + -