【问题标题】:Classic asp page is throwing "internal server 500 error"经典的 asp 页面抛出“内部服务器 500 错误”
【发布时间】:2016-01-14 10:40:35
【问题描述】:

连接文件

<%
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Open "abc","ID","Password"
    conn.commandtimeout=120

    Set RS = Server.CreateObject("ADODB.RecordSet")
    rs.activeConnection = Conn

%>

经典 ASP 文件

<%response.buffer = true%>
<%Response.Expires = 0%>
<!-- #include file="functions.asp" -->

<% Response.Write session("RequestID")%>
<%if session("ValidLogon") <> "true" then
    if request("FromEmail") = "True" then
        SetSessVar()
    else%>
        <%response.redirect "Default.asp"
    end if
end if%>

<html>
<body>

<%rs.Source = "SELECT * from tblRequests WHERE RequestID = " & request("requestID")

rs.Open

session("RequestID") = rs("requestid")

if rs("RequestType") = "O" then

    response.clear

    If request("Tag") = "Change" then
        response.redirect "abc.asp#change"
    else
        response.redirect "abc.asp?From=" & request("From")
    end if

else

    response.clear

    If request("Tag") = "Change" then
        response.redirect "editinternal.asp#change"
    else
        response.redirect "editinternal.asp?From=" & request("From")
    end if

end if
rs.close%>

</body>
</html>

我检查了经典的 asp 页面,看起来“正文”标签内的语法错误。我对此一无所知。

它给出内部服务器错误 500。

【问题讨论】:

  • 如果您提供完整的 500 错误、它发生在哪一行以及错误描述是什么,将会有所帮助?
  • 您知道如何配置 IIS 以提供经典 asp 的详细错误消息吗? chestysoft.com/asp-error-messages.asp
  • @John- 我不知道。你能帮帮我吗?
  • John 提供了一篇文章的链接,该文章详细介绍了如何在 IIS 中设置详细错误,您看过了吗?

标签: vbscript asp-classic


【解决方案1】:

在连接文件中,您在rs.activeConnection = Conn 上缺少Set,因为您正在设置对ADODB.Connection 对象实例的对象引用,但未传递连接字符串。

'Object instances require Set
Set rs.activeConnection = Conn

【讨论】:

  • @Amit 那么错误是什么,完整的描述?!?您希望我们如何提供帮助?难以置信,这绝对是个问题,但您的代码可能不止一个问题。但不能一直猜测。
【解决方案2】:

请确保您将站点配置为向客户端发送详细的错误消息

这描述了如何: Show detailed errors

我猜你的连接“abc”/“ID”/“Password”必须是一个真实的连接。看来您只是写了一些东西来看看会发生什么。它也可能是您包含的“functions.asp”文件。该文件是否存在,它包含什么?

请发回您的详细错误信息,我们可以为您提供更好的帮助。

【讨论】:

    【解决方案3】:

    在引用记录集之前,您应该检查记录集是否包含任何记录,例如:

    If not rs.eof then
      Session("reqestid") = rs("reqestid")
      ....
    End If
    

    这里只想加一个矩阵,试试在body标签后面加这两行

    Response.Write "<br>For the sake of debug"
    Response.Flush
    

    如果您启用了缓冲,这有时会写出错误而不是抛出错误 500。经常帮助我。

    【讨论】:

      猜你喜欢
      • 2012-12-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多