Solved

Validate Query String URL

Posted on 2006-11-07
4
194 Views
Last Modified: 2010-04-07
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..
0
Comment
Question by:JRockFL
  • 2
4 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 300 total points
ID: 17889815
Hi JRockFL,

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

Tim Cottee
0
 
LVL 4

Assisted Solution

by:satish_nagdev
satish_nagdev earned 100 total points
ID: 17890027
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
 
LVL 11

Expert Comment

by:ethoths
ID: 17890099
A neater way to check for multiple possibilities is...


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

0
 
LVL 11

Assisted Solution

by:ethoths
ethoths earned 100 total points
ID: 17890129
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

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now