Saturday, August 13, 2005

Hide mailto links for spam bots

I have earlier written code to encode "mailto:" links in my webpages to hide them from spam bots. Recently I found a component on http://www.dotnet2themax.com that does this very easy.

SafeMailLink is a HttpModule for ASP.NET that prevents the action of spam bot software that search and extract e-mail addresses from Internet pages. Once it is set-up with a line in the site's web.config file, it dynamically encodes the "mailto:" links found on your pages at runtime, just before the HTML code generated by the page is sent to the target browser. Links with parameters that pre-fill the mail's subject and body fields (among others) are also supported and encoded correctly. E-mail addresses used as text for the e-mail hyperlink are protected as well. Full C# source code included.

The component is availible here.

0 comments: