已答覆 憑證錯誤畫面

  • 2009年9月2日 上午 01:37
     
     
    我想請問在憑證錯誤時會出現custom error
    請問有辨法可以修改custom error page嗎
    或是在發生錯誤時有觸發任何事件

    謝謝

所有回覆

  • 2009年9月2日 上午 01:32
     
     
    我想請問在憑證錯誤時會出現custom error
    請問有辨法可以修改custom error page嗎
    或是在發生錯誤時有觸發任何事件

    謝謝
  • 2009年9月3日 上午 02:01
    版主
     
     已答覆 包含代碼
    你好,
    你可以在web.config中进行如下配置,以指定出错后转向的页面。
      <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
                <error statusCode="403" redirect="NoAccess.htm" />
                <error statusCode="404" redirect="FileNotFound.htm" />
            </customErrors>
    其次你也可以在global文件中添加Application_Error处理方法。
     void Application_Error(object sender, EventArgs e) 
        {
            Response.Write(((System.Web.HttpApplication)(sender)).Context.Error.StackTrace);
            
        }

    Microsoft Online Community Support