让你的错误提示更生动
来源:互联网 发布:java自行车好吗 编辑:程序博客网 时间:2024/06/05 18:32
导读:
默认的IIS 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
%> 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
%>
a:link {font:9pt 宋体; color:FF0000}
a:visited {font:9pt 宋体; color:#4e4e4e}
本页无法显示
试图访问的网页出现问题,无法显示。
HTTP 500.100 - 内部服务器错误 - ASP 错误
默认的IIS 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
%> 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
%>
a:link {font:9pt 宋体; color:FF0000}
a:visited {font:9pt 宋体; color:#4e4e4e}
本页无法显示
试图访问的网页出现问题,无法显示。
请尝试以下方法:
- 单击
刷新按钮或者梢候再试。
- 打开
主页,然后查找与所需信息相关的链接。
HTTP 500.100 - 内部服务器错误 - ASP 错误
Internet 信息服务
技术信息(适用于支持人员)
- 错误类型:
<%
Dim bakCodepage
bakCodepage = Session.Codepage
Session.Codepage = 936
Response.Write Server.HTMLEncode(objASPError.Category)
If objASPError.ASPCode > 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) &")" ) &"
"
If objASPError.ASPDescription >""Then Response.Write Server.HTMLEncode(objASPError.ASPDescription) &"
"
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 "
"
Response.Write ""
Response.Write Server.HTMLEncode(objASPError.Source) &"
"
If objASPError.Column >0 Then Response.Write String((objASPError.Column - 1), "-") &"^
"
Response.Write ""
blnErrorWritten = True
End If
End If
If Not blnErrorWritten And objASPError.File <>"?" Then
Response.Write ""
Response.Write Server.HTMLEncode(objASPError.File)
If objASPError.Line >0 Then
Response.Write Server.HTMLEncode(", 第 "&objASPError.Line &"行") &"
"
'读去错误行文本
Dim AppPath,FileName,ErrLine,ErrCode,fs,f,i
AppPath=Request.ServerVariables("APPL_PHYSICAL_PATH")
FileName=Request.ServerVariables("SCRIPT_NAME")
FileName=Replace(FileName,"/","/")
FileName=Mid(FileName,2,Len(FileName)-1)
'Response.Write AppPath &FileName &"
"
'常量定义
Const ForReading = 1,TristateFalse = 0
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile(AppPath &FileName,ForReading,TristateFalse)
ErrLine=objASPError.Line
For i = 1 to ErrLine-1
f.SkipLine
Next
ErrCode=f.ReadLine
f.close
Response.Write "该代码出现错误,请检查→
本文转自
http://study.qqcf.com/web/243/29368.htm- 让你的错误提示更生动
- 让你的错误提示更生动
- 让Spinner更生动
- 图片排版——让你的课件更生动的技巧 - [PPT|设计]
- 分享让游戏设计更生动的润色技巧
- 第三讲 让网页更生动美观
- 制作更生动的演示文档
- 让你的网页文字动起来。。。
- 让你的图标动起来
- ViewDragHelper让你的app动起来
- 让你的web程序“动”起来。
- 让你的程序“动”起来。
- 让你的网页动起来的秘诀
- Ios 让你的UITabbar上的按钮动起来
- 沟通——让你的团队动起来
- 使用 FactoryBean 让你的 spring 配置动起来
- 仅用CSS让你的div动起来-------Day23
- iOS开发之让你的应用“动”起来(动画)
- 手推车”功能的实现
- 用数据库生成不重复的流水号
- 域名专题 - 使用NTFS的权限设置
- ASP数据库事务处理
- 五子棋两个控件之一fiveclient
- 让你的错误提示更生动
- 关闭屏幕保护
- 取自charset.h的其他数字定义
- 理解JavaScript中的事件【转载】
- 关于Materal Master Safety Stock 和 MRP 的一些联系…
- C语言核心技术
- 易用性测试参考(转载)
- 孙振耀撰文谈退休并畅谈人生
- 基础的prototype.js常用函数及其用法