[thelist] Re: if...or...then in asp

darren thelist at lists.evolt.org
Mon Feb 25 13:39:01 2002


On 25 February 2002 at 19:24:10, Anthony Baratta <Anthony@Baratta.com> wrote:

AB> At 12:04 AM 2/25/2002, George Klingenhoffer wrote:
>>Using ASP, what's the proper way to evaluate this and is does this account
>>for most ways that someone could enter a bogus value for 'curpage' in the
>>url:
>>
>><%
>>If (Not IsNumeric(Request("curpage"))) Or (Request("curpage") < 1) Then
>>         CurrentPage = 1
>>Else
>>         CurrentPage = Request("curpage")
>>End If
>>%>

AB> If (Not IsNumeric(Request("curpage"))) _
AB>          Or (CInt(Trim(Request("curpage"))) < 1) Then

if Request("curpage") is not numeric wouldn't this throw an error as asp
doesn't short-circuit the logic...it's always going to check both terms
even though the isNumeric test has failed?

the original method looks fine to me...

darren