Credit Card Validation:

While with ASP alone you can't verify that a credit card belongs to this person, that it isn't stolen, that the credit is good or that the purchase price doesn't exceed the card's limit -- you can verify that it is a possible number before bothering to waste transaction time with a true verification authority.

Syntax:
isCreditCard variable
Example Usage:
<%


CreditCardNo = "4111111111111111"
Response.Write(isCreditCard(CreditCardNo))



%>
ASP Source Code:
<%
 function isCreditCard(cardNo) 
        isCreditCard = false 
        lCard=len(cardNo) 
        lC=right(cardNo,1) 
        cStat=0 
        for i=(lCard-1) to 1 step -1 
            tempChar= mid(cardNo,i,1) 
            d=cint(tempChar) 
            if lcard mod 2 = 1 then 
                temp=d*(1+((i+1) mod 2)) 
            else 
                temp=d*(1+(i mod 2)) 
            end if 
            if temp < 10 then 
                cStat = cStat + temp  
            else 
                cStat = cStat + temp - 9 
            end if 
        next 
        cStat = (10-(cStat mod 10)) mod 10 
        if cint(lC) = cStat then isCreditCard = true 
    end function 

	' **************** AS A TEST **************** 
    ' 
    ' 4111111111111111 should pass (test number) 
    ' 4111111111111112 should fail 
	response.write("1:" & isCreditCard("4111111111111111") & "<br>") 
    response.write("2:" & isCreditCard("4111111111111112") & "<br>") 


%>