asp.net - 你可以在 ASP 中堆叠多个 IF 语句吗?我的不工作
问题描述
我负责我工作的公司的电子商务网站。我对任何编程都很陌生,主要是从谷歌和这里学习堆栈溢出。
因此,如果我正在做的事情是愚蠢的或听起来不正确,我很抱歉。
问题:我们使用一个利用 ASP 的软件来为我们的网页整合内容,因为我们有超过 1000 种产品,这让我的生活更轻松。但是,我正在尝试编辑生成元标记的源,并且无法使 IF 语句正常工作。见下文:
If (pcStrPageName = "living-in-a-printers-paradise.asp") Then
Response.Write "<title itemprop=""name"">"""Living in a Printer's Paradise""" </title>" & vbcrlf & _
"<META NAME=""description"" CONTENT="""The Wide-Format Printing Industry isn't always the easiest nor enjoyable industry to write or read about and we have decided to write for you, the reader.""" />" & vbcrlf & _
"<META NAME=""Keywords"" CONTENT="""Wide Format Printers, Digital Media Warehouse Blog, Digital Media Warehouse, Large Format Printers, Wide Format Printing, Large Format Printing, Printer, Printing, Printer Blog, Printing Blog, Wide Format Printing Blog, Wide Format Printer Blog""" />" & vbcrlf & _
"<META NAME=""Robots"" CONTENT=""index,follow"" />" & vbcrlf & _
"<META NAME=""Revisit-after"" CONTENT=""30"" />" & vbcrlf
Else
'// START - Write Meta Tags
if trim(Title)<>"" then
Response.Write "<TITLE itemprop=""name"">" & Title & "</TITLE>" & vbcrlf
end if
if trim(mtDescription)<>"" then
Response.Write "<META NAME=""description"" CONTENT=""" & mtDescription & """ />" & vbcrlf
end if
if trim(Keywords)<>"" then
Response.Write "<META NAME=""Keywords"" CONTENT=""" & Keywords & """ />" & vbcrlf
end if
'// No Follow on Search, Message pages, ViewCart page, Checkout pages, but Follow all others...
If (pcStrPageName = "search.asp") OR (pcStrPageName = "msg.asp") OR (pcStrPageName = "msgb.asp") OR (pcStrPageName = "checkout.asp") OR (pcStrPageName = "onepagecheckout.asp") OR (pcStrPageName = "viewcart.asp") OR (pcStrPageName = "showsearchresults.asp") OR (sScriptName = "viewprd.asp") Then
Response.Write "<META NAME=""Robots"" CONTENT=""noindex,nofollow"" />" & vbcrlf & _
"<META NAME=""Revisit-after"" CONTENT=""30"" />" & vbcrlf
Else
Response.Write "<META NAME=""Robots"" CONTENT=""index,follow"" />" & vbcrlf & _
"<META NAME=""Revisit-after"" CONTENT=""30"" />" & vbcrlf
End If
'// Add Canonical URL
if pcStrCanonicalURL<>"" then
'if UCase(Request.ServerVariables("HTTPS"))="ON" then
' pcStrCanonicalURL=replace(pcStrCanonicalURL,"http://","https://")
'end if
Response.Write "<link rel=""canonical"" href=""" & pcStrCanonicalURL & """ />" & vbcrlf
end if
End If
解决方案
我有 3""" 而不是 2"" 通过更改这些问题消失了。抱歉浪费您的时间!!-</p>
推荐阅读
- php - 如何克服 php 中函数的变量范围问题?
- visual-studio - CLIon - 无法让 Visual Studio 工具链工作:无法打开文件“MSVCRTD.lib”
- python - 额外的字数列表
- postgresql - plpgsql中的回滚测试事务
- r - 如何为 lapply 循环中创建的 ggplots 分配唯一的标题和文本标签?
- excel - vlookup 从其他行中提取值
- java - Java Class2.getClass() 返回错误的类
- java - setOnClickListener 在片段 Android 中不起作用
- python - OpenCV从adaptiveThreshold函数返回的图像中的每个像素都是值255
- reactjs - 避免使用 react + redux 显示旧数据。总是等待获取完成