May 01, 2008

Safer Email Address

Direct email addresses used in the website are supposed to be caught by the mail bots that capture the email addresses from the website. But as the browsers support ascii display (&#ASCII CODE) we can use them so if the mail capturing program captures this encoded address (which is also difficult for them as they try to find mailto: which they won't get) it will not be useful to them unless they decode it. There are mail capture programs that know this alternative but most of them are not written considering this case.
To see how ascii character display is supported just paste the following code to any html or aspx page and browse it


<a href="&#109&#97&#105&#108&#116&#111&#58&#97&#98&#99
&#64&#97&#98&#99&#46&#99&#111&#109"> &#97&#98&#99&#64&#97&#98&#99&#46&#99&#111&#109< /a>


you can even try to click the link to send email it will get the correct email address to the mail client. And also view the page source for double check the email address is ascii encoded.
So this conversion code (just loop through the characters in email address and build a string consisting of ["&#" + ascii code of character] that is "&#97" = "a" of email address.) can also be put in the overridden method PreRender to secure the emails in the page if it has any.

This is for the text emails otherwise the image emails are good and there are lot of online tools that makes the image email addresses for you.

Happy Programming...!!!

Submit this story to DotNetKicks

0 comments: