I would like to display "me@mymail.com" at the browser. I know it’s unsafe to display email address like that. So, when we view source it appear as a javascript.Is this possible with razor. I use to work like that with codeigniter php framework safe_email() when displaying email address in browser.
I would like to display me@mymail.com at the browser. I know it’s unsafe to
Share
The fact you’re using Razor is irrelevant. The only way to keep email addresses safe from address harvesters is to obfuscate it in the page, then use client-scripting to deobfuscate it for appropriate clients. I like to use human-readable obfuscation as not to lock-out users with scripting disabled. This is what I do (using MVC WebForms syntax):
Escaping text shields them from harvesters, but the script will automatically reveal it in any competent browser. Users without scripts will see a human-readable obfuscated address which they can trivially correct themselves.