类库方法代码: public static void CheckUserName(System.Web.UI.Page parent) { HttpResponse Response = parent.Response; System.Security.Principal.IPrincipal p = HttpContext.Current.User; if(p.Identity.Name.ToLower() != "yan") { Response.Redirect("LowerPower.aspx"); } } 页面调用: ConfirmBase.CheckUserName(this.Page); 转载于:https://www.cnblogs.com/yell_7709/archive/2006/02/18/333120.html