Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

How to do the URL encryption/decryption C#?

$
0
0

Hi All,

I want to do the URL encryption across the application. Please provide some common method to implement the URL encryption/Decryption in C#. How to generate the encryption key randomly for particular session to use for encryption and decryption.

As of now I am generation random encryption key using below code

private static Random random = new Random();
public static string RandomString(int length)
{
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
return new string(Enumerable.Repeat(chars, length)
.Select(s => s[random.Next(s.Length)]).ToArray());
}

I am not able to keep the key for particular session. Please sombody provide the input on it ASAP.

Thanks in advance

Ambrish


Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>