欢迎光临
我们一直在努力

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

建站超值云服务器,限时71元/月

最近经常有人问在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>

主页,然后查找与所需信息相关的链接。 </li>

</ul>

<h2 style="font: 9pt 宋体; color:000000">http 500.100 – 内部服务器错误 – asp 错误<br>

internet 信息服务</h2>

<hr color="#c0c0c0" noshade>

<p>技术信息(适用于支持人员)</p>

<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>"

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 & " 列"

——————————————————————-

added by bigeagle

date: 2000/5/10

dim l_straspdescription

l_straspdescription = "错误原因:" + objasperror.description()

if l_straspdescription <> "" then

response.write("<p>" + l_straspdescription+ "</p>")

end if

l_straspdescription = "详细描述:" + objasperror.aspdescription()

if l_straspdescription <> "" then

response.write("<p>" + l_straspdescription+ "</p>")

end if

——————————————————————-

response.write "</b><br>"

end if

%>

</li>

<p>

<li>浏览器类型:<br>

<%= request.servervariables("http_user_agent") %>

</li>

<p>

<li>页:<br>

<%

strmethod = request.servervariables("request_method")

response.write strmethod & " "

if strmethod = "post" then

response.write request.totalbytes & " bytes to "

end if

response.write request.servervariables("script_name")

lngpos = instr(request.querystring, "|")

if lngpos > 1 then

response.write "?" & left(request.querystring, (lngpos – 1))

end if

response.write "</li>"

if strmethod = "post" then

response.write "<p><li>post 数据:<br>"

if request.totalbytes > lngmaxformbytes then

response.write server.htmlencode(left(request.form, lngmaxformbytes)) & " . . ."

else

response.write server.htmlencode(request.form)

end if

response.write "</li>"

end if

%>

<p>

<li>时间:<br>

<%

datnow = now()

response.write server.htmlencode(formatdatetime(datnow, 1) & ", " & formatdatetime(datnow, 3))

session.codepage = bakcodepage

%>

</li>

</p>

<p>

<li>详细信息:<br>

<% strquerystring = "prd=iis&sbp=&pver=5.0&id=500;100&cat=" & server.urlencode(objasperror.category) & _

"&os=&over=&hrd=&opt1=" & server.urlencode(objasperror.aspcode) & "&opt2=" & server.urlencode(objasperror.number) & _

"&opt3=" & server.urlencode(objasperror.description)

strurl = "http://www.microsoft.com/contentredirect.asp?" & _

strquerystring

%>

<a href="<%= strurl %>">microsoft 支持</a>

</li>

</p>

</font></td>

</tr>

</table>

</body>

</html>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 有关win2000、IIS5中asp详细出错信息的显示
分享到: 更多 (0)

相关推荐

  • 暂无文章