Validate Query String URL

Default.aspx expects a URL variable for member number.
For example, default.aspx?MemberNumber=3270000

How can I test for things like

default.aspx?MemberNumber=#member
default.aspx?MemberNumber=

etc..etc..
LVL 8
JRockFLAsked:
Who is Participating?
 
TimCotteeConnect With a Mentor Head of Software ServicesCommented:
Hi JRockFL,

If IsNumeric(Request.QueryString("MemberNumber")) Then
    'do something

Tim Cottee
0
 
satish_nagdevConnect With a Mentor Commented:
hi,
first check if the parameter is passed
If Request.QueryString("MemberNumber") is nothing Then
    'some problem parameter not passed.

hope it helps,
satish
0
 
ethothsCommented:
A neater way to check for multiple possibilities is...


Select Case Request.QueryString("MemberNumber") & String.Empty
    Case""

0
 
ethothsConnect With a Mentor Commented:
Premature submission...


A neater way to check for multiple possibilities is...

Select Case Request.QueryString("MemberNumber") & String.Empty    
    Case""

    Case "#member"


End Select

Be careful about the option compare. If set to text it is case insensitive (this might not be important).
Concatinating an empty string stops you having to explicitly check for nothing! It jsu maske the code cleaner and simpler to read.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.