MVC 5 encrypt parameters–SEO

 

I have added SEO ( ok, a bullshit example of SEO ) to http://msprogrammer.serviciipeweb.ro/2017/03/20/mvc-5-encrypt-parameters/ .

This is pretty simple :

 public class EncDecSEOBullShit : IEncryptDecrypt
    {
        //public static string FullName = typeof(EncDecSEOBullShit).AssemblyQualifiedName;
        const string seo = "this-is-seo-";
        public string DecryptString(string value)
        {
            return value.Replace(seo, "");
        }

        public string EncryptString(string value)
        {
            return seo + value;
        }
    }

 

the action is

<a href=’@Url.ActionEnc(new EncDecSEOBullShit(), “TestEncryptSEO”, new {id=7, a = 1, b = “asd” })’>Test</a>

It generates url such as:

http://mvc5encrypt.apphb.com/Home/TestEncryptSEO/7?a=this-is-seo-1&b=this-is-seo-asd

The Action Filter to decrypt takes the full type name ( with assembly name) of the class that does SEO ( or encrypt / decrypt)

[MVCDecryptFilter(EncDecFullClassName = "MVCEncryptDemo.EncDecSEOBullShit, MVCEncryptDemo")]

Example at

http://mvc5encrypt.apphb.com/