I am developing a project with Asp.net , and have an encryption method. when i use it to encrypt a string ,it returns a string that contains some chars like ‘+’ and because i use its returned values in my querystring i need to remove these chars
ex :
http://localhost/Cpanel/CompanyInfo/Hotels/EditHotel/VKWbk+G9F6E=
Error : HTTP Error 404.11 – Not Found
The request filtering module is configured to deny a request that contains a double escape sequence.
http://localhost/Cpanel/CompanyInfo/Hotels/EditHotel/bprrmsZ6atI=
It works great
this is my encryption method :
public static string EncryptString(string Message)
{
string Passphrase = System.Configuration.ConfigurationSettings.AppSettings["CryptographyKey"];
byte[] Results;
System.Text.UTF8Encoding UTF8 = new System.Text.UTF8Encoding();
//Hash the passphrase using MD5
MD5CryptoServiceProvider HashProvider = new MD5CryptoServiceProvider();
byte[] TDESKey = HashProvider.ComputeHash(UTF8.GetBytes(Passphrase));
TripleDESCryptoServiceProvider TDESAlgorithm = new TripleDESCryptoServiceProvider();
TDESAlgorithm.Key = TDESKey;
TDESAlgorithm.Mode = CipherMode.ECB;
TDESAlgorithm.Padding = PaddingMode.PKCS7;
byte[] DataToEncrypt = UTF8.GetBytes(Message);
try
{
ICryptoTransform Encryptor = TDESAlgorithm.CreateEncryptor();
Results = Encryptor.TransformFinalBlock(DataToEncrypt, 0, DataToEncrypt.Length);
}
finally
{
TDESAlgorithm.Clear();
HashProvider.Clear();
}
return HttpUtility.HtmlEncode(Convert.ToBase64String(Results));
}
how i can do that ?
When you prepare query string value, do as :
and then pass it to query string.
At time of reading query string use method for decode like:
Let me know for any concerns.