0

Whenever I click on a link I am calling an action in a controller with parameters via a jQuery AJAX request. I am using a URL like this:

http://localhost:5224/Ideation/Ideation?IdeaId=110186&userRole=1

I need to encrypt that ideaid and userrole. How can I do it? That ideaid and userole need to be encrypted.

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
venkat
  • 1
  • 1
  • There's lots of ways of encrypting and lots of libraries available to do it for you, regardless of if you choose to do this in JS or C#. See the duplicates for more information. – Rory McCrossan Aug 23 '19 at 08:14
  • 1
    What is the scenario you are trying to prevent via the encryption? – piet.t Aug 23 '19 at 08:15
  • I'm not sure why you want to encrypt the parameters but if you really don't want anyone to potentially see them, you might consider creating an extra sql table with 3 columns: linkGuid, IdeaId, userRole. On server side, for each link you want to display on the page that would otherwise include these parameters, create a record in that table with linkGuid being a unique, generated GUID for the specific IdeaId / userRole pair. Use that linkGuid as your url parameter and, when your controller receives the call, let it retrieve IdeaId and userRole based on the linkGuid. –  Aug 23 '19 at 08:49

0 Answers0