This project is read-only.
1
Vote

Encrypt id in query string

description

Hi friends ,

I am working on MVC application . My question id when i click a record to edit its id become visible like plain text i want to know how to encrypt that so no one can understand that expect me.Kindly please mention how to add this in action link.


Original : http://localhost:8080/PCTList/Edit/91

I Want : http://localhost:8080/PCTList/Edit/-----------encrypted from------------


Thanks

comments

Saineshwar wrote Sep 24, 2016 at 6:56 AM

You need to create Custom Helper method for URL encryption and decryption.

The below link will help you.

http://www.dotnettrace.net/2013/09/encrypt-and-decrypt-url-in-mvc-4.html

Then to use custom helper method in Grid.MVC

columns.Add().Titled("Edit").Encoded(false).Sanitized(false).SetWidth(30)
.RenderValueAs(c =>
@<b>
@if (string.IsNullOrEmpty(c.CustomerID))
    {
        @Html.EncodedActionLink("View", "EditData", "EditView", new { param1 = c.CustomerID, param2 = c.ApplicationNo }, null)
    }
    else
    {
        if (Convert.ToString(c.Approval1) == "C")
        {
        @Html.Label("Approved");
        }
    }

</b>);