【问题标题】:Check variable exists in current url in classic asp [duplicate]检查变量存在于经典asp中的当前url中[重复]
【发布时间】:2017-03-29 15:35:22
【问题描述】:

有没有办法在asp中检查当前页面上是否存在变量? IE。 网址:https://stackoverflow.com/?question=something 我想检查 ?question 变量是否存在。

<%Request.ServerVariables("Query_String")%> 会给出 question=something 但我只想知道当前 url 是否包含 ?question。我不在乎实际值是多少,只要它存在即可。

【问题讨论】:

  • fyi,这似乎是在谈论经典的 asp 而不是 asp.net,所以我重新标记了
  • Ofc 这个问题之前已经回答过了。

标签: url asp-classic request query-string


【解决方案1】:

询问Request 收藏:

HasParam = Request("question").Count > 0

【讨论】:

  • 有没有一种简单的方法来否定它,以便它在没有 ?question 的情况下请求值
  • +1。但我会特别使用Request.QueryString("question").Count。您不希望因为 post 参数或具有相同名称的 cookie 而出现误报。
  • @user5753132 HasNoQuestionParamInUrl = Request.QueryString("question").Count = 0 然后你可以使用If HasNoQuestionParamInUrl Then ..
猜你喜欢
  • 2012-06-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-11-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多