Codefixer - ASP tutorials, resources and software
New MS SQL 2008 Available – DiscountASP.NET
Home   Articles   Resources   ASP directory   ASP Tutorials   Code Snippets   ASP Applications   Forum
Sunday 7 September
MembersPro PayPal - ASP Membership software

USA & Europe Data Centers – DiscountASP.NET


ASP Partner ASP Partner ASP Partner more partners...

Check Value passed in the QueryString is Numeric

The code below simply checks that the ID value passed in the Querystring isn't empty and is numeric. We use the Len function and IsNumeric VBscript functions to do this.

<%
If Len(Request.Querystring("ID"))>0 AND IsNumeric(Request.Querystring("ID")) Then
'execute your code
End If
%>

You may think that using the LEN function isn't necessary but indeed it is. I ran a test and found that If ID is left out of the querystring and there is no value passed as in the URL below, isNumeric(request.querystring(ID)) would indeed return TRUE.

www.codefixer.com/index.asp

It's best therefore to do the double check that the querystring isn't empty and also that it's value is numeric.





If you have any code snippets to share with full credit given then send an email to Codesnippets - You'll receive full credit and a link back to your site.

ASP.NET 3.5/2.0 Web Hosting: 3 Months FREE – Click Here!




About | Contact | Advertise | Feedback | Hire Us | Link

Site developed by Michael Wall - Web Design Belfast N.Ireland.
Copyright © 2000-2008. All rights reserved.

Do you intend to move to ASP.NET or have you already?
Yes will do
Have done
ASP does fine
Not a priority


Directory Software