我是经典asp的新手,我试图找出这个简单的if else语句。 出于某种原因,它只是认出了第二人,甚至没有尝试过人1?
有关如何修复的任何想法?感谢
这是我的代码:
<%
Dim GetPath
GetPath = request.ServerVariables("URL") & query_string
Dim page
page = "/products/dowlex/index.htm"
if GetPath = page then
varrecipient = "email1@email.com"
Response.Write("*Path = " & GetPath)
Response.Write("Person 1")
else
varrecipient = "email2@email.com"
Response.Write("*Path = " & GetPath)
Response.Write("Person 2")
end if
varFormName = "Contact"
varRHBusinessUnit = "businessname"
varLanguage = "ENGLISH"
varCourtesyResponse = "Y"
varRedirect = "#noredir?formRun=true"
varSubject = "Ask an Expert Form"
%>
答案 0 :(得分:1)
我会根据相同的情况比较两个字符串......
如果UCase(GetPath)= UCase(页面),那么
当然,如果query_string有一个值,那么第一种情况永远不会成立。
答案 1 :(得分:1)
我有几个想法。
1)你能使用Response.Write来显示&#34; GetPath&#34;在if语句之前?这可能会帮助你了解出了什么问题!
2)尝试更改变量名称。编辑正在制作&#34; GetPath&#34;蓝色,好像它是一个保留字。这可能会搞砸了。
答案 2 :(得分:1)
你的陈述格式正常。如果...那么......否则......结束如果。
我会做一个Response.Write(&#34; GetPath&#34;)看看你是否回来了,你认为你应该是什么。
答案 3 :(得分:0)
对不起伙计们,我搞砸了一个小代码,这就是为什么它不起作用了。 我忘了完成网站的完整路径。感谢您的所有帮助和建议!
*Path = /plasticpipes/eu/products/dowlex/index.htm
*Page = /products/dowlex/index.htm