Solved

Validate Query String URL

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

911 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

20 Experts available now in Live!

Get 1:1 Help Now