2017-09-13 27 views
0

HTMLサイトをASP.Net 4.0 Webアプリケーションに移行しています。既存のHTMLページのURLを入力すると、対応するASPページにリダイレクトします。HTML 7アプリケーションをASP.NET 4.0に移行中に、IIS 7でGlobal.asaxのアプリケーションエラーが発生しない

私はすでに以下の提案を試していますが、何も問題はありません。 Global.asaxのページ内のApplication_Error法下コードの下に含ま

enter code here 
<customErrors mode="On"> 
    <error statusCode="404" redirect="~/Error.aspx" /> 
</customErrors> 
enter code here 
  • が働いていない -

    1. はweb.configファイルに、いくつかのASPページにリダイレクトカスタムエラータグが含まれていました。 - それは

      enter code here 
      
      void Application_Error(object sender, EventArgs e) 
          { 
           // Code that runs when an unhandled error occurs 
           string fullOrginalpath = Request.Url.ToString(); 
           string strPathExtn = 
            Request.CurrentExecutionFilePathExtension.ToString(); 
           if (fullOrginalpath.Contains(".html")) 
           { 
            Server.ClearError(); 
            Response.Clear(); 
            fullOrginalpath = fullOrginalpath.Replace(".html", ".aspx"); 
            Response.Redirect(fullOrginalpath); 
           }   
          } 
      enter code here 
      
    2. がweb.cofigにhttpErrorsタグを持つしようとしました発生しません - それは500内部エラーがスローされます。

  • 答えて

    関連する問題