如何在PreInit阶段提前结束页面的生命周期 我重载了OnPreInit,然后在操作中调用了Dispose方法,但是我发现还会接着去调用各个控件的Init方法和页面的Page_Load方法。请问有什么办法能提前结束页面的生命周期? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不是很明白,给你个连接看一下吧!http://www.cnblogs.com/tianyue3107/archive/2009/04/21/1440278.html 直接在事件中写return;……就不会继续执行了…… protected void Page_PreInit(object sender, EventArgs e) { Page.Dispose(); }经过调试……不会继续执行了…… 写个httphandler吧,额外判断在handler里做,不合要求直接抛空页面或错误页面,否则继续执行。 public class AspxHandleFactory : IHttpHandlerFactory, System.Web.SessionState.IRequiresSessionState { #region IHttpHandlerFactory 成员 public IHttpHandler GetHandler(HttpContext context, string requestType, string url, string pathTranslated) { if (符合额外检查要求) { return System.Web.UI.PageParser.GetCompiledPageInstance(url, pathTranslated, context);//继续传个原本的aspx页面处理 } else {//否则转到错误页。 string filepath = "~/AccessDenial.aspx"; if (url.ToLower().Contains("popwindow.aspx")) filepath = "~/AccessDenial2.aspx"; return System.Web.UI.PageParser.GetCompiledPageInstance(filepath, context.Server.MapPath(filepath), context); } } void IHttpHandlerFactory.ReleaseHandler(IHttpHandler handler) { } #endregion } 一个怪异的问题 【求解答】MVC路由怎么配置带参数的URL? 做个小调查:有多少人做asp.net,用到flex?? __EVENTVALIDATION是什么?有什么作用 如何在数据访问层获取当前路径 vs2003和vs2005中新建的项目怎么删除? 水晶報表高手:水晶報表10中頁導航的問題,在線等待。。。 用尽可用分-----发邮件的问题! freetextbox的问题,搞了一下午 如何传递Form里的东西? 请问这个代码有问题吗?我改了好久没改出来! 请各位高手多指教,新手上路! JavaScript向Flash传值
http://www.cnblogs.com/tianyue3107/archive/2009/04/21/1440278.html
protected void Page_PreInit(object sender, EventArgs e)
{
Page.Dispose();
}
经过调试……不会继续执行了……
public class AspxHandleFactory : IHttpHandlerFactory, System.Web.SessionState.IRequiresSessionState
{ #region IHttpHandlerFactory 成员 public IHttpHandler GetHandler(HttpContext context, string requestType, string url, string pathTranslated)
{
if (符合额外检查要求)
{
return System.Web.UI.PageParser.GetCompiledPageInstance(url, pathTranslated, context);//继续传个原本的aspx页面处理
}
else
{//否则转到错误页。
string filepath = "~/AccessDenial.aspx";
if (url.ToLower().Contains("popwindow.aspx"))
filepath = "~/AccessDenial2.aspx";
return System.Web.UI.PageParser.GetCompiledPageInstance(filepath, context.Server.MapPath(filepath), context);
} } void IHttpHandlerFactory.ReleaseHandler(IHttpHandler handler)
{ } #endregion }