In my MVC application, I want to encrypt and decrypt data in data transfer in terms of the controller. How to do it in MVC 4 using Razor ?
based on this comment: "Suppose I send an identifier from my view to my controller and I want to encrypt this identifier?"
if you want to encrypt the "id" in the view, in this case you already have the "id" in the view, the "id" will be generated in the database or another, but not on the client.
In this case, you can encrypt "id" after you put it on the client, and then the controller decrypts only "id".
Here you have an example that encrypts only "id", this is done to ensure security so that the data does not look for "id".
In this case, you need to encrypt and decrypt the property:
fooobar.com/questions/790815 / ...http://amitpatelit.com/2011/08/08/url-encryption-in-mvc-application/
This example (in Spanish) is executed for all parameters that are accepted with an underscore (_):
http://geeks.ms/blogs/etomas/archive/2012/07/08/asp-net-mvc-encriptar-routevalues.aspx? utm_source = FeedBurner & utm_medium = feed & utm_campaign = stream% 3A + BurbujasNetGeeks +% 28Burbujas + en + .NET +% 28% 40geeks.ms% 29% 29
You do not need to encrypt data from the controller to the view, since the view is rendered on the same computer on which the controller is running.
If you want to encrypt the page sent to the user, you must use the ssl connection