为什么在vs2003中context.RewritePath可以用, 但在vs2005中为什么没有那样的效果啊???
       
         我写了一个类实现了IHttpModule接口。在context.AcquireRequestState 事件的实现中,用了context.RewritePath,为什么定位不到想要的页面啊。。。。。
 public void Init(HttpApplication context)
        {
            // TODO:  添加 EngineModule.Init 实现
            context.AcquireRequestState += new EventHandler(context_AcquireRequestState);
            context.PreRequestHandlerExecute += new EventHandler(context_PreRequestHandlerExecute);
        }
        public void Dispose()
        {
            // TODO:  添加 EngineModule.Dispose 实现
        }
#endregion
        private void context_AcquireRequestState(object sender, EventArgs e)
        {
            string path = HttpContext.Current.Request.Path.ToLower();
            if (path.EndsWith(".aspx") || path.EndsWith(".axd"))
            {
                if (path != "/ars/default.aspx")
                    HttpContext.Current.RewritePath("Default.aspx");
            }
        }
        private void context_PreRequestHandlerExecute(object sender, EventArgs e)
        {
        }
    我输入的地址是:http://localhost:1513/Ars/someurl.axd
  系统报错是:
 
“/Ars”应用程序中的服务器错误。
无法找到资源。
说明: HTTP 404。您正在查找的资源(或者它的一个依赖项)可能已被移除,或其名称已更改,或暂时不可用。请检查以下 URL 并确保其拼写正确。 
请求的 URL: /Ars/Default.aspx
   但在vs2003中又可以。。。
 真的好郁闷。。。
 
                    
                     
                    
                 
                    
                 

 
         
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号