MVC Encrypt

MVC Encrypt is a NuGet package to encrypt/decrypt query string parameters

Encrypt example

In the View , the original link looks like this:

<a href='@Url.Action("TestEncrypt", new {id=7, a = 1, b = "asd" })'>Test</a>
live link: Test

To encrypt, please modify to this:

<a href='@Url.ActionEnc("mySecret", "TestEncrypt", new {id=7, a = 1, b = "asd" })'>Test</a>
Do not forget @using MVCEncrypt;

livelink: Test
In the action, please add attribute MVCDecryptFilter

            [MVCDecryptFilter(secret = "mySecret")]
            public ActionResult TestEncrypt(int id,int a, string b)
            {
                  ViewBag.id = id;
                  ViewBag.a = a;
                  ViewBag.b = b;
                  return View();               
            }
            

Learn more »

SEO example

In the View , the original link looks like this:

<a href='@Url.Action("TestEncrypt", new {id=7, a = 1, b = "asd" })'>Test</a>
live link: Test

To encrypt, please modify to this:

<a href='@Url.ActionEnc(new EncDecSEOBullShit(), "TestEncryptSEO", new {id=7, a = 1, b = "asd" })'>Test</a>
Do not forget @using MVCEncrypt;

livelink: Test
In the action, please add attribute MVCDecryptFilter

            [MVCDecryptFilter(EncDecFullClassName = "MVCEncryptDemo.EncDecSEOBullShit, MVCEncryptDemo")]
            public ActionResult TestEncryptSEO(int id,int a, string b)
            {
                ViewBag.id = id;
                ViewBag.a = a;
                ViewBag.b = b;
                return View();
            }