频道直达 - 专题 - 新闻 - 技巧 - 组网 - 开发 - 安全 - web编程 - 图像 - 操作系统 - 数据库 - 教育 - 旅游 - 健康 - 时尚 - 驱动 - 软件 - 游戏 - 多媒体 - ERP - 讨论组

有关win2000、IIS5中asp详细出错信息的显示

来源: 作者: 出处:巧巧读书 2006-09-04 进入讨论组

  最近经常有人问在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="instructionsText1">单击
      <a href="javascript:location.reload()">
      刷新</a>按钮或者梢候再试。<br>
      </li>
      
      <li>打开
      
      <script>
      <!--
      if (!((window.navigator.userAgent.indexOf("MSIE") > 0) && (window.navigator.appVersion.charAt(0) == "2")))
      {
           Homepage();
      }
      //-->
      </script>

      主页,然后查找与所需本U R L:http://www.qqread.com/asp/2006/10/d240688.html 更多文章 更多内容请看IIS服务器应用技巧IIS技术专题服务器配置专题,或进入讨论组讨论。
收藏此文】【 】【打印】【关闭
相关图文阅读
频道图文推荐
健 康 咨 询
时 尚 咨 询
巧巧读书宗旨
相关专题
最新论坛文章
站内各频道最新更新文档
站内最新制作专题
热门关键字导读
Photoshop教 程照片处理 照片制作 PS快捷键 抠图
计 算 机 故 障XP系统修复
艺 术 与 设 计设计 流媒体 设计欣赏 边框
计 算 机 安 全ARP
站内频道文章精选
巧巧电脑频道编辑信箱  告诉我们您想看的专题或文章