有關win2000、IIS5中asp詳細出錯資訊的顯示(不難,但很多人問)

來源:互聯網
上載者:User
iis|顯示     最近經常有人問在win2000和IIS5中不顯示asp錯誤的詳細資料,而只顯示錯誤號碼,如"錯誤ID800xxxxx",這使得程式調試很不方便,有些人採取在IIS中設定500-100錯誤指向預設,這樣做也不會出現詳細的錯誤資訊。實際上這可能是微軟出於安全考慮而在500-100.asp中沒有顯示詳細出錯資訊。其實,你只要把500-100.asp稍加修改就可以了。下面是我修改的這個檔案的內容。你只要把他copy下來存為500-100.asp然後覆蓋原來的這個檔案就可以了。注意檔案中兩行橫線之間就是我修改的部分。


500-100.asp:


<%@ language="VBScript" %>
<%
  Option Explicit

  Const lngMaxFormBytes = 200

  Dim objASPError, blnErrorWritten, strServername, strServerIP, strRemoteIP
  Dim strMethod, lngPos, datNow, strQueryString, strURL

  If Response.Buffer Then
    Response.Clear
    Response.Status = "500 Internal Server Error"
    Response.ContentType = "text/html"
    Response.Expires = 0
  End If

  Set objASPError = Server.GetLastError
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<html dir=ltr>

<head>
<style>
a:link            {font:9pt 宋體; color:FF0000}
a:visited        {font:9pt 宋體; color:#4e4e4e}
</style>

<META NAME="ROBOTS" CONTENT="NOINDEX">

<title>本頁無法顯示</title>

<META HTTP-EQUIV="Content-Type" Content="text-html; charset=gb2312">
<META NAME="MS.LOCALE" CONTENT="ZH-CN">
</head>

<script>
function Homepage(){
<!--
// in real bits, urls get returned to our script like this:
// res://shdocvw.dll/http_404.htm#http://www.DocURL.com/bar.htm

    //For testing use DocURL = "res://shdocvw.dll/http_404.htm#https://www.microsoft.com/bar.htm"
    DocURL=document.URL;
    
    //this is where the http or https will be, as found by searching for :// but skipping the res://
    protocolIndex=DocURL.indexOf("://",4);
    
    //this finds the ending slash for the domain server
    serverIndex=DocURL.indexOf("/",protocolIndex + 3);

    //for the href, we need a valid URL to the domain. We search for the # symbol to find the begining
    //of the true URL, and add 1 to skip it - this is the BeginURL value. We use serverIndex as the end marker.
    //urlresult=DocURL.substring(protocolIndex - 4,serverIndex);
    BeginURL=DocURL.indexOf("#",1) + 1;
    urlresult=DocURL.substring(BeginURL,serverIndex);
        
    //for display, we need to skip after http://, and go to the next slash
    displayresult=DocURL.substring(protocolIndex + 3 ,serverIndex);
    document.write('<A HREF="' + urlresult + '">' + displayresult + "</a>");
}
//-->
</script>

<body bgcolor="FFFFFF">

<table width="410" cellpadding="3" cellspacing="5">

  <tr>    
    <td align="left" valign="middle" width="360">
    <h1 style="COLOR:000000; FONT: 9pt 宋體"><!--Problem-->本頁無法顯示</h1>
    </td>
  </tr>
  
  <tr>
    <td width="400" colspan="2">
    <font style="COLOR:000000; FONT: 9pt 宋體">試圖訪問的網頁出現問題,無法顯示。</font></td>
  </tr>
  
  <tr>
    <td width="400" colspan="2">
    <font style="COLOR:000000; FONT: 9pt 宋體">

    <hr color="#C0C0C0" noshade>
    
    <p>請嘗試以下方法:</p>

    <ul>
      <li id="instruction



相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.