Asp classic 在经典asp中,如果块在外部工作,则include virtual不在内部工作

Asp classic 在经典asp中,如果块在外部工作,则include virtual不在内部工作,asp-classic,include,Asp Classic,Include,出于某种原因,如果我的include在if语句中,那么它确实有效。我明白了 500-内部服务器错误。您使用的资源有问题 正在查找,但无法显示 但我在if外部包含了同一行,它正确呈现并显示表单。我遗漏了什么吗 <% elseif EmailError <> "?" then %> <p class="StdParaHead">Can't Send Message</p> <p st

出于某种原因,如果我的include在if语句中,那么它确实有效。我明白了

500-内部服务器错误。您使用的资源有问题 正在查找,但无法显示

但我在if外部包含了同一行,它正确呈现并显示表单。我遗漏了什么吗

<% elseif EmailError <> "?" then %>
                <p class="StdParaHead">Can't Send Message</p>
                <p style="color:red;font-weight:bold">Please fill in
                <%if EmailError="NameBlank" then
                    Response.Write "your name"
                ElseIf EmailError = "EmailBlank" OR EmailError = "InvalidEmail" then
                    Response.Write "a valid e-mail address"
                ElseIf EmailError = "LocationBlank" then
                    Response.Write "your City and State"
                ElseIf EmailError = "BadSecurity" then
                    Response.Write "the proper security information"
                End if
                %></p>
                <p>clause1 </p>
<!--#include virtual="/includes/Content/ContactFormNew.inc"--> /* does not work here */

    <% else %>
                <p class="StdParaHead">Sorry...</p>
                <p>Due to an uncertain error, your message could not be sent at this time. Please see our <a href="contact.asp">contact information</a> for other ways to contact Axiom Valuation Solutions, or try again later.</p>
                <p><a href="/newlook/newsite/default.asp">Home</a></p>
                <p> CLAUSE 2</p>
<!--#include virtual="/includes/Content/ContactFormNew.inc"--> /* does not work */
    <%end if%>
<!--#include virtual="/includes/Content/ContactFormNew.inc"--> /* works here */

无法发送消息

请填写

第1条

/*这里不行*/

对不起

由于不确定的错误,您的邮件此时无法发送。有关联系Axiom估价解决方案的其他方式,请参阅我们的,或稍后再试

第2条

/*不起作用*/ /*在这里工作*/
所以我最好的猜测是您在“ContactFormNew.inc”中定义了一些变量

由于您无法像尝试执行的那样“动态”包含文件,因此该文件将被包含两次

这是因为include是在解释任何ASP代码之前完成的,并且“ContactFormNew.inc”的内容被注入两次(在elseif end else块中)


因此,文件包含两次,然后错误为obviuo,因为您两次定义了相同的变量…

http状态代码500表示服务器端脚本中的错误。但必须对该错误进行详细描述。请检查iis日志或更改iis以将脚本错误发送到浏览器以获取详细的错误描述。此外,如果您在ie中查看页面,请在首选项中设置“显示详细的http错误”复选框。您可以从
/includes/Content/ContactFormNew.inc
粘贴代码吗?请注意,在ASP Classic中不可能有条件包含。您的脚本将包含该文件。基于if-else结构,将处理某些include。我还没有得到详细的错误信息。问题是这个。我通过移除并重新放入来验证这一点。ContactFormNew.inc只是一个asp文件,其中也包含一些javascript。在代码的最后一个include中,它工作正常。没有问题。嗯,如果您不从
ContactFormNew.inc
发布相关代码,我们将无法帮助您。那个文件中的某些东西把事情搞砸了。我会尝试一下,但我得到的错误是if块中的“file not found”。在外部,它可以正常工作。OP中的@Guido comment也解决了这个问题。我包括了一次文件,一切都很好:)底部,行,包括在相同的文件,如果否则,两者都将包括在内。但是这里的错误非常奇怪,并且完全具有误导性,
找不到文件