码迷,mamicode.com
首页 > Web开发 > 详细

过滤asp.net页面每次发出请求之前访问

时间:2015-05-27 12:07:50      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:

public class PageFiltert : System.Web.UI.Page
{
public PageFiltert()
{
//
//TODO: 在此处添加构造函数逻辑
//
}
protected override void OnPreInit(EventArgs e)
{
//context.PostRequestHandlerExecute += new EventHandler(this.Application_beginRequest);
//this.OnPreInit += new System.EventHandler(Application_beginRequest);
//this.Load += new System.EventHandler(Application_beginRequest);
if (!Page.IsPostBack)
{
if (HttpContext.Current.Session["userName"] == null)
{
HttpContext.Current.Response.Write("<script>window.parent.location.href=‘../../login.aspx‘</script>");//必须是根目录
Response.End();
//HttpContext.Current.Response.Redirect("~/login.aspx");
}
}
base.OnPreInit(e);
}
}

过滤asp.net页面每次发出请求之前访问

标签:

原文地址:http://www.cnblogs.com/jinhaoObject/p/4532865.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!