2
如何检查查询字符串在VB.NET中是否有参数?我很难适应C#代码到VB。VB.NET查询字符串有参数
我对确定是否存在无值/无关键参数特别感兴趣。
伪代码:
If Request.QueryString.Contains("test") Then
' ...
End If
例子:
http://example.com/mypage.aspx?test
http://example.com/mypage.aspx?test=1
http://example.com/mypage.aspx?someparam=1&test&anotherparam=2
为了澄清,我不在乎test
是否具有价值。我只想知道它是否在查询字符串中。
感谢。这将适用于我的场景,但值得注意的是,如果另一个参数的值在其值中包含相同的'test'字符串,即'?someparam = test',则可能有匹配。 – Quantastical
@Quantastical不应该太复杂。在这种情况下,除了上述解决方案之外,还应该检查键/值对的实际值。 –