Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VB.NET querystring has parameter

Tags:

asp.net

vb.net

How do I check if a query string has a parameter in VB.NET? I'm having a hard time adapting C# code to VB.

I'm particularly interested in determining if a value-less/key-less parameter exists.

Pseudo-Code:

If Request.QueryString.Contains("test") Then
    ' ...
End If

Examples:

http://example.com/mypage.aspx?test
http://example.com/mypage.aspx?test=1
http://example.com/mypage.aspx?someparam=1&test&anotherparam=2

To clarify, I don't care whether or not test has a value. I just want to know if it is in the query string or not.

like image 966
Jeff Jenkins Avatar asked Jun 13 '26 23:06

Jeff Jenkins


1 Answers

if Request.QueryString("test").Count > 0  then
    ...
end if

Source: https://www.w3schools.com/asp/coll_querystring.asp

like image 86
Honza Zidek Avatar answered Jun 15 '26 22:06

Honza Zidek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!