[devtalk] ASP help

Robert Hoenig rhoenig at hoenigcomputers.com
Tue Oct 27 17:17:14 GMT 2009


I would agree that reinventing the wheel is not the ideal but the problem is
most libraries especially for asp are in javascript.  You could use Google
or Microsoft's CDN to get their jquery libraries but then you'd be back to
if javascript is disabled your validation won't work.  This is just a last
ditch effort to validate the email so no sql injections happen or cross site
scripting.  I think I saw regular expressions being used which should allow
for most of the below emails.   

-----Original Message-----
From: devtalk-bounces at lists.preshweb.co.uk
[mailto:devtalk-bounces at lists.preshweb.co.uk] On Behalf Of David Precious
Sent: Tuesday, October 27, 2009 12:00 PM
To: New home for the wdvltalk community
Subject: Re: [devtalk] ASP help

Robert Hoenig wrote:
> You could check that javascript is off and then use an asp script 
> validation.  Here's the asp script I use.

Heh, why must people re-invent the email validation wheel so much?

>    ' has no more than 3 chars after last "."
>    elseif len(theAddress) - instrrev(theAddress,".") > 3 then
>       chkEmail = 1

What about all the new TLDs - .aero, .museum etc?

And, to be awkward, what about e.g. bob@[127.0.0.1] (which is valid, if
very-rarely used :) )

>       ' has only one "@"

Technically, I believe "Dave @ work"@example.com is valid, although again
rarely seen.

 >       ' chk each char for validity

That allows characters in places they shouldn't be allowed, and disallowed
characters that should be allowed.

e.g. bob+somelist at example.com should be accepted, bob at example_host.com
shouldn't be

I'd strongly recommend using whatever libraries your language of choice
provides to validate email addresses, rather than doing it for yourself!

Cheers

Dave P


_______________________________________________
devtalk mailing list
devtalk at lists.preshweb.co.uk
http://lists.preshweb.co.uk/mailman/listinfo/devtalk



More information about the devtalk mailing list