public void ProcessRequest(HttpContext context)
{
string path=HttpContext.Current.Request.Path;
object user=new object();
bool hasPrivilege= SecurityCheck.CheckPrivilege(user,path,formAtcion);
if (hasPrivilege)            
{
//继续执行
path=context.Request.Path;
string realPath=context.Request.Path;
HttpContext.Current.Server.Execute(path);
}else{
//跳到错语页面
HttpContext.Current.Server.Transfer("~/Page/Error.aspx");
}
}
出错的时候报错为:Exception Details: System.Web.HttpException: Error executing child request for “/Com.Uds.PMU.Web/Default.aspx.”即执行子请求时出错,用Server.execute()也同样出错
那位兄弟解决过类似问题,帮一下忙。

解决方案 »

  1.   

    你做权限判断吧?应该用IHttpModule
    IHttpHandle本来就是截断正常的请求来由你自己处理,应该不会在允许真正的地址来处理请求了
      

  2.   

    SRZ007
    是想做一个权限总控,而且IHttpModule可以实现,但我感到奇怪的是:怎么在IhttpHandle中会用不了
    Server.transfer()和server.Execute()
      

  3.   

    Context.Application.Lock();
    Context.Application["online"] = Online;
    Context.Application.UnLock();看上面这个,是不是用Context?
      

  4.   

    每个方法都有其特点
    IHttpModule != IHttpHandle
    要是两者作用一样,干吗还要2个呢,你说呢,呵呵
      

  5.   

    trycontext.RewritePath (newpath);
      

  6.   

    区别我知道是有的,在这我也不说了,网上很多资料我的想法是处理完之后,该到什么页面,还是到什么页面,我用的是transfer和execute但我感到奇怪的是:怎么在IhttpHandle中会用不了Server.transfer()和server.Execute()老是出现Error executing child request for "...."
    这个错误,我发现也有好多人碰到这样的问题。
      

  7.   

    http://chs.gotdotnet.com/quickstart/util/srcview.aspx?path=/quickstart/aspplus/samples/apps/handler/handler.src&file=CS\handler.cs&font=3上面URL里提到的
            public bool IsReusable {
                get {
                    return true;
                }
            }
    是起什么作用的?