Go to content

Go to employees

Go to search

Epinova.EmailObfuscator: New module on Epicode

Are your customers tired of being spammed? Here are the solution: A Httpmodule that obfuscates all e-mail addresses on the webpage

Lars Øyvind Bodahl
 

Most people are annoyed by the amount of spam emails we receive every day, and our customers are getting tired of being spammed as well. The main problem is webpages that exposes e-mail addresses directly on the website. As web developers, we can make a difference and make it impossible for robots to crawl our sites for e-mail addresses.

In Epinova, we have been using our email obfuscator for more than three years, and we decided it was about time to share it with the rest of you EPiServer developers. Epinova.EmailObfuscator is a genius httpmodule that obfuscates all mail addresses on the webpage. Robots crawling the webpage will not see any e-mail addresses, but instead they will see HTML like this:

<img id='Eoi_2' class='obfimg' 
src='/Images/emailimages/cfd193fe7638bf102ecd4c457812350a.png' alt=''  />
<script type="text/javascript"><!--
document.write(dc('Eoi_2', '7A44154[LOOONG STRING]471C1F08125A1B46'));//-->
</script>

Users browsing the site will not notice anything different on the page. And if the browser does not support javascript, a picture of the email address will be displayed instead.

To have a look at this project, you can download it from Coderesort (https://www.coderesort.com/p/epicode/wiki/Epinova.EmailObfuscator) and try it yourself :-)

Tags


Comments:

  1. Hej, Har du et eksempel på hvordan man får Epinova.EmailObfuscator til at virke? Måske et asp,net website, hvor du bruger Epinova.EmailObfuscator.
  2. Oppland fylkeskommune er et kundeeksempel:
    Gå til http://www.oppland.no/Kontakt-oss/Organisasjon/Sentraladministrasjonen/Aalstad-Gunhild/

    Her er mailadressen klikkbar, men source'en viser:
    <img id="Eoi_1" class="obfimg" src="/Images/emailimages/2119856e76b58ec93f0d79cdaf07aa00.png" alt="" /><script type="text/javascript"><!-- document.write(dc('Eoi_1', '7A441B55461D0815541E141B160A0A153A1E1B0E09161B1B541E161312140F1D44581D0815541E141B160A0A153A1E1B0E09161B1B541E161312140F1D40150E16131B1758471C1F08125A1B46'));//--></script>

    Hvis du skrur av javascript i browseren din så vil den gå til fallback løsning, og vise bildet istedet.

    Vi bruker det også på vår side. Se på "min" side http://www.epinova.no/menneskene/lars-oyvind-bodahl/ Mailadressen min er erstattet med bilde, ingen e-postadresse i source'en

  3. Ja, det ser super godt ud. Jeg har gjort dette. Oprettet et asp.net website. Tilføjet disse dll er: - log4net.dll - Epinova.EmailObfuscator.dll Tilføjet dette i web.config´en: <add name="Epinova.EmailObfuscator" type="Epinova.EmailObfuscator.HttpHandler"/> Er der andet jeg skal gøre?
  4. Ja, det ser super godt ud. Jeg har gjort dette. Oprettet et asp.net website. Tilføjet disse dll er: - log4net.dll - Epinova.EmailObfuscator.dll Tilføjet dette i web.config´en: <add name="Epinova.EmailObfuscator" type="Epinova.EmailObfuscator.HttpHandler"/> Er der andet jeg skal gøre?
  5.  

    Du må ha emailObfuscator.config filen også. (jeg skal kontrollere installasjonsbeskrivelsen på coderesort.com senere i dag!)
    I web config må du ha:
    <?xml version="1.0"?>
    <configuration>
    <configSections>
    ......
    <section name="emailObfuscator" type="Epinova.EmailObfuscator.Configuration.ObfuscatorSection" allowLocation="true" allowDefinition="Everywhere"/>
    ...
    <emailObfuscator configSource="emailObfuscator.config"/>  f.eks. rett før <system.web>
    Det ligger tre eksempel config filer i prosjektet. På min maskin kjører jeg med:
    <emailObfuscator obfscateMailto="true"
                     obfscateMailText="true"
                     filePattern=".aspx" >
        <font name="Verdana"
              size="11"
              color="000000"
              imagePath="/emailimages"
              storagePath="C:\Inetpub\vpp\emailimages" />
        <allow>
            <add urlPattern="/templates/rssfeed.aspx"
                 sameDomain="true"
                 verb="GET|POST|HEAD" />
        </allow>
    </emailObfuscator>

     

    Du må ha emailObfuscator.config filen også. (jeg skal oppdatere installasjonsbeskrivelsen på coderesort.com senere i dag!)

    I web config må du ha:
    <?xml version="1.0"?>
      <configuration>
      <configSections>
        ......
        <section name="emailObfuscator" type="Epinova.EmailObfuscator.Configuration.ObfuscatorSection" allowLocation="true" allowDefinition="Everywhere"/>

    Og:
    <emailObfuscator configSource="emailObfuscator.config"/>  f.eks. rett før <system.web>

    Det ligger tre eksempel config filer i prosjektet. På min maskin kjører jeg med emailObfuscator.config som ser slik ut:
    <emailObfuscator obfscateMailto="true" obfscateMailText="true" filePattern=".aspx" >    
      <font name="Verdana" size="11" color="000000" imagePath="/emailimages" storagePath="C:\Inetpub\vpp\emailimages" />
      <allow>        
        <add urlPattern="/templates/rssfeed.aspx" sameDomain="true" verb="GET|POST|HEAD" />
      </allow>
    </emailObfuscator>

  6. NB! Hvis du er autentisert bruker så vil ikke email obfuscator slå til!

  7. Virker det kun sammen med epi server? Hvor finder man installasjonsbeskrivelsen henne?
  8. Den fungerer på alle .net applikasjoner med IIS og .Net 2 eller høyere.

    Auch.... Jeg glemte at man må registrere http handleren........... Sorry.

    Følgende må inn i web.config:

    <system.Webserver>
    <modules ....>
    <add name="EmailObfuscator" type="Epinova.EmailObfuscator.HttpHandler, Epinova.EmailObfuscator" />

    <system.Webserver><modules ....><add name="EmailObfuscator" type="Epinova.EmailObfuscator.HttpHandler, Epinova.EmailObfuscator" />

    Jeg skal opprette dokumentasjon på coderesort i kveld. Jeg sender en norsk dokumentasjon på e-post!

  9. Hello Thanks for a great module. But I'm having a tiny problem with geting it to work. I have followed the instructions steps in EPiCode e.g. 1.Build and drop the DLL in your bin directory 2.Edit web.config file like described above 3.Add an emailObfuscator.config file to the root of your website but nothing happens. Can you please guide me in the right directions?
  10. Make sure you are not authenticated when trying it out. It will not obfuscate e-mail addresses if you are logged on. Make sure that the user running the application pool have write access on the folder specified in the imagePath in your config file. If none of those things help, let me know :) You could also download the source, compile it and debug it to see what happens.
  11. Thanks for the tips. I did some debugging and saw that the embedded script (page.ClientScript.GetWebResourceUrl in EmailFilter.cs Line 67) got some bad URL i my case, so I changed the two lines and inbedded the raw script from the emaildeobfuscator.js file instead directly in the page. Everything is upp and running now. Thanks again.
Post a comment