Sunday, November 9, 2008

Weekly Source Code: No SPAM Email Link In .Net

Web crawlers gather email addresses from your website that they then use to SPAM you. Web crawlers do this by reading the raw HTML to see if there are any email tags like a "mailto:".

I wrote a sample program that I published to MSDN Code Gallery where an email address get shown to a website visitor as an image in the HTML's image tag, you can see Facebook as an example.

The image tag then has an onclick event, when visitors click on the image an AJAX call fetches the email address (from a resource like a SOAP/RESTful web service) and then open the default email client.

With this method the email address isn't in the HTML so the web crawler can't capture it.

This show the power that AJAX bring.


Anonymous said...

Hi Lennie,

If a spam-crawler can somehow be made to click the image and interpret the resulting ajax response they could get the email address from there?


Lennie De Villiers said...

Hi Zahir: True yes. But the spam-crawler must be that clever since most spam-crawlers are just looking for "mailto:" tags.