上一篇:函数型显示翻页连接 >>
关于错误信息的显示
步骤一,用编辑器打开c:\winnt\help\iisHelp\common\500-100.asp
将它另存为500-101.asp备份(以便日后恢复)
步骤二,将下面的代码覆盖500-100.asp原文件,保存退出
步骤三,创建新文件test.asp,添加如下代码
<% response.write now(1)%>
存盘退出
步骤四,在浏览器中输入localhost/test.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="‘’ + escape(urlresult) + ‘’">‘’ + displayresult + "</a>");
}
//-->
</script>
<body bgcolor="FFFFFF">
<ul>
<li>错误类型:<br>
<%
Dim bakCodepage
bakCodepage = Session.Codepage
Session.Codepage = 936
Response.Write Server.HTMLEncode(objASPError.Category)
If objASPError.ASPCode > "" Then Response.Write Server.HTMLEncode(", " & objASPError.ASPCode)
Response.Write Server.HTMLEncode(" (0x" & Hex(objASPError.Number) & ")" ) & "<br>"
If objASPError.ASPDescription > "" Then Response.Write Server.HTMLEncode(objASPError.ASPDescription) & "<br>"
%>
</li>
<p>
<li>错误位置:<br>
<%
blnErrorWritten = False
‘’ Only show the Source if it is available and the request is from the same machine as IIS
If objASPError.Source > "" Then
strServername = LCase(Request.ServerVariables("SERVER_NAME"))
strServerIP = Request.ServerVariables("LOCAL_ADDR")
strRemoteIP = Request.ServerVariables("REMOTE_ADDR")
If (strServername = "localhost" Or strServerIP = strRemoteIP) And objASPError.File <> "?" Then
Response.Write Server.HTMLEncode(objASPError.File)
If objASPError.Line > 0 Then Response.Write ", 第 " & objASPError.Line & " 行"
If objASPError.Column > 0 Then Response.Write ", 第 " & objASPError.Column & " 列"
Response.Write "<br>"
Response.Write "<font style=""COLOR:000000; FONT: 9pt 宋体""><b>"
Response.Write Server.HTMLEncode(objASPError.Source) & "<br>"
If objASPError.Column > 0 Then Response.Write String((objASPError.Column - 1), "-") & "^<br>"
Response.Write "</b></font>"
blnErrorWritten = True
End If
End If
If Not blnErrorWritten And objASPError.File <> "?" Then
Response.Write "<b>"
Response.Write Server.HTMLEncode(objASPError.File)
If objASPError.Line > 0 Then Response.Write Server.HTMLEncode(", 第 " & objASPError.Line & " 行")
If objASPError.Column > 0 Then Response.Write ", 第 " & objASPError.Column & " 列"
Response.Write "</b><br>"
End If
%>
</li>
<p>
<li>错误描述:<br>
<%
response.write Server.HTMLEncode(objASPError.description)
%>
</li>
<p>
</body>
</html>
比较容易用。
上面的测试文件“test.asp”是放在wwwroot目录下的。
下一篇:怎样开始一个ASP网站的设计 >>
相关文章:
- · ASP之对象总结
- · 错误80004005信息处理方法
- · ASP问答集
- · MicrosoftVBscript运行时错误(完整版)共121个
- · Asp设计常见问题及解答精要
- · 程序员应具备的素质
- · 我学习ASP、网页制作中的几点心得~(参考)
- · 在VBScript中使用类(四)
- · 在VBScript中使用类(三)
- · 错误80004005信息处理又一方法
- · 在VBScript中使用类(二)
- · 在VBScript中使用类(一)
- · 常用Response对象的使用祥解
- · session和cookie的最深刻理解
- · 利用客户端js实现汉字简体繁体转换
- · asp程序错误详细说明例表
- · 简单WEB开发规范
- · asp程序错误详细说明例表
- · HTA的简单应用
- · 请教一个问题!
- · 动态网页制作规范
- · 关于学习c++和编程的50个观点(学什么都适用)
- · 常见的80004005错误及其解决方法
- · ASP设计常见问题及解答精要(4)(完)
- · ASP设计常见问题及解答精要(3)
- · ASP设计常见问题及解答精要(2)
- · ASP设计常见问题及解答精要(1)
- · 如何才能成为一名真正的Web程序员
- · 两星级ASP版社区之星编写的ASP常见问题解答
- · 大中型网络公司的一条发展之路
- · ASP错误代码说明
- · jscript错误代码及相应解释大全
- · vbscript错误代码及对应解释大全
- · VBScript 错误信息一览
- · ASP错误处理
- · 使用ASP开发web站点
- · Web设计里的软件工程思想
- · 关于Adodb.Stream 的使用说明
