2009-08-12 15 views
0

404に基づいてURLリライトを実行しようとしています。論理が "aspxerrorpath"をチェックしても、常にnullとして表示されます。私のコードは、devサーバー上で完璧に動作します。私はcustomerrorsをオンにしました。また、私のハンドラを指しているIISコントロールパネルにcustomerrorsがあります。なぜそれが404のURLを渡していないのアイデア???aspxerrorpath NULL IIS 6の場合

public class UrlHandler : Handler301 
{ 
    protected override string getRedirectionUri() 
    { 
     HttpContext.Current.Response.ContentType = "text/plain"; 

     String request = HttpContext.Current.Request.QueryString["aspxerrorpath"]; 
     if (request != null) 
     { 
      SomeUrl url = getUrlLogic(); 

      if (url != null) 
      { 
       return url.ReferencedUrl; 
      } 
      else 
      { 
       return ConfigurationManager.AppSettings["404RedirectionUri"]; 
      } 
     } 
     else 
     { 
      String site = HttpContext.Current.Request.Url.AbsoluteUri; 

      return site.Substring(0, site.LastIndexOf('/')); 
     } 
    } 
} 

答えて

0

IISを異なるのdevのサーバーよりもそのクエリ文字列を行い判明:

String request = HttpContext.Current.Request.QueryString["aspxerrorpath"]; 

if (StringUtils.isNullOrEmpty(request)) 
{ 
    String rawUrl = HttpContext.Current.Request.RawUrl; 

    if (rawUrl.Contains("?404")) 
    { 
     request = rawUrl.Substring(rawUrl.LastIndexOf('/')); 
    } 
} 

それはクエリ文字列aspxerrorpath代わりクエリ文字列を使用しています? ASP.NET開発者用サーバーが使用します。