using System; using System.Collections.Generic; using System.Text; using System.Web; namespace HTB.DevFx.Security { /// /// 当前系统用户认证器,存储当前用户认证信息 /// public class Authenticator { /// /// 当前登录的用户编号,未登录则为0 /// public static int UserID { get { return HttpContext.Current.User.Identity.IsAuthenticated ? Convert.ToInt32(HttpContext.Current.User.Identity.Name) : 0; } } /// /// 标示当前用户是否已经通过认证 /// public static bool IsAuthenticated { get { return HttpContext.Current.User.Identity.IsAuthenticated; } } } }