Use below given code to validate querystring variables.
Private Function ValidateQueryString() As Boolean
If Request.QueryString("name") <> Nothing Then
If Request.QueryString("name").ToString() <> String.Empty Then
Return True
End If
Else
Return False
End If
End Function
This code first checks for existence of querystring variable "name". If it exists, then it's check for it's value. As sometimes it's quite possible that the querystring variable is present but with no value. Something like this : www.abc.com/default.aspx?name=
Over here no value is assigned to name variable. So we need to check it's value also.
Thanks,
Virendra Dugar