Cookie是ASP
本實例介紹如何使用在ASP
在Visual Studio
在應用程序Example_
public class EncryptString
{
private static byte[] Key
private static byte[] IV
private static byte[] Key
private static byte[] IV
public static String Encrypt(String valueString)
{
if(valueString !=
{ //定義DES的Provider
DESCryptoServiceProvider desprovider =
new DESCryptoServiceProvider();
//定義內存流
MemoryStream memoryStream = new MemoryStream();
//定義加密流
CryptoStream cryptoStream = new CryptoStream(memoryStream
desprovider
CryptoStreamMode
//定義寫IO流
StreamWriter writerStream = new StreamWriter(cryptoStream);
//寫入加密後的字符流
writerStream
writerStream
cryptoStream
memoryStream
//返回加密後的字符串
return(Convert
(int)memoryStream
}
return(null);
}
public static String Decrypt(String valueString)
{
if(valueString !=
[
From:http://tw.wingwit.com/Article/program/net/201311/15124.html