在类库中使用Response
类库方法代码:
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");
}
}
{
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);