自定义asp错误信息的显示
作者:editer 发布时间:2007-09-13 12:33:00
标签:错误,自定义
asp程序出错后,错误提示不是很清楚明白,让人摸不着头脑,用下面方法看看有没有帮助(此法目前只适合除ADO错误外的错误)
步骤一,用编辑器打开c:winnt\helpiis\Helpcommon\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>


猜你喜欢
- optim.Adam()解读torch.optim是一个实现了多种优化算法的包,大多数通用的方法都已支持,提供了丰富的接口调用,未来更多精炼
- 前言本文使用 cpu 版本的 tensorflow 2.4 ,在 shakespeare 数据的基础上使用 Skip-Gram 算法训练词嵌
- $str=preg_replace("/\s+/", " ", $str); //过滤多余回车 $s
- python中捕获键盘操作一共有两种方法第一种方法:使用pygame中event方法使用方式如下:使用键盘右键为例if event.type
- import urllib.parse,os.path,time,sysfrom http.client import HTTPSConne
- 准备工作右击新建的项目,选择Python File,新建一个Python文件,然后在开头import cv2导入cv2库。转成灰度图像调用i
- (一)ts文件下载网页文件下载其实都可以通过requests.get以文件流的形式获取,并以字节的形式写入本地文件即可。代码如下:impor
- Python 队列Queue 队列是一种先进先出(FIFO)的数据类型, 新的元素通过 入队 的方式添加进 Queue 的末尾, 出队 就是
- 前言对于HTTP请求,我们要在脑子里有一个根深蒂固的概念,那就是任何客户端传过来的数据都是不可信任的。那么开发接口的时候需要对客户端传提交的
- 如下所示:logprobs.new_zeros(logprobs.size())pytorch 0.4版本中用到的新建一个与logprobs
- 最近小爬一直思忖着如何将以前写的一些半自动化程序转为全自动化,这其中就涉及到SAP的打开和登录过程。我们都知道,SAP原生的&ldq
- 一、需求分析我们首先有一个成绩表单,但是学生的成绩是按照学号进行排序的,现在,我们希望清晰明了的知道每一个学生的名次,并且需要将学生按照成绩
- 由于微博的网页端有反爬虫,需要登录,所以我们换个思路,曲线救国。我们找到微博在浏览器上面用于手机端的调试的APL,如何找到呢?我这边直接附上
- 在写python程序时,对于可变对象和不可变对象这里理解不深,导致总会犯一些细节错误。以下面的程序举例:ab = {'a':
- 1.在搭建网络开始时,会调用到 keras.models的Sequential()方法,返回一个model参数表示模型2.model参数里面
- 原来在robotframework中使用press key方法进行键盘的操作,但是该方法需要写 * 作对象的locator,不是很方便,现在找
- 现在很多朋友都不止一个账户,不止一个密码。忘记账户名、密码,或账户名、密码输入错误也就难免啦。每当这个时候,你是否和我一样会有小小的焦虑产生
- pyplot直方图的绘制import matplotlib.pyplot as pltimport numpy as npfrom pyla
- APScheduler就是定时进行周期性的运行某些程序,在语言程序编写中,一直会遇到些定时服务,有时是根据时间定时,有时在固定的位置上进行定
- vue单页开发时经常需要父子组件之间传值,自己用过但是不是很熟练,这里我抽空整理了一下思路,写写自己的总结。GitHub地址:https:/