Solved

Validate Query String URL

Posted on 2006-11-07
4
199 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 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