Here's how I do it: -
dim memberID : memberID = Request.QueryString("ID") if memberID <> "" then memberID = CLng(memberID) if memberID = Empty then memberID = Session("MemberID")
The item QueryString property returns either Empty or String . He will never return an integer.
If memberID is not parsed as an integer, then this code will be erroneous. However, if the value in the ID must be an integer, but really is something else, I would like it to fail.
Empty compared with both the null string and the number 0.
source share