how sloved this error
this string is=wvu/sd+abcd
Decrypt is =wvu/sd abcd
this query parmater send with
String cannot be of zero length.
private static byte[] key = { };
private static byte[] IV = { 38, 55, 206, 48, 28, 64, 20, 16 };
private static string stringKey = "!1341a#BR";
public static string Encrypt(string text)
{
try
{
key = Encoding.UTF8.GetBytes(stringKey.Substring(0, 8));
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
Byte[] byteArray = Encoding.UTF8.GetBytes(text);
MemoryStream memoryStream = new MemoryStream();
CryptoStream cryptoStream = new CryptoStream(memoryStream,
des.CreateEncryptor(key, IV), CryptoStreamMode.Write);
cryptoStream.Write(byteArray, 0, byteArray.Length);
cryptoStream.FlushFinalBlock();
return Convert.ToBase64String(memoryStream.ToArray());
}
catch (Exception ex)
{
}
return string.Empty;
}
public static string Decrypt(string text)
{
try
{
key = Encoding.UTF8.GetBytes(stringKey.Substring(0, 8));
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
Byte[] byteArray = Convert.FromBase64String(text);
MemoryStream memoryStream = new MemoryStream();
CryptoStream cryptoStream = new CryptoStream(memoryStream, des.CreateDecryptor(key, IV), CryptoStreamMode.Write);
cryptoStream.Write(byteArray, 0, byteArray.Length);
cryptoStream.FlushFinalBlock();
return Encoding.UTF8.GetString(memoryStream.ToArray());
}
catch (Exception ex)
{
}
return string.Empty;
}
public static string encodeSTROnUrl(string thisEncode)
{
if (null == thisEncode)
return string.Empty;
return HttpUtility.UrlEncode(Encrypt(thisEncode));
}
public static string decodeSTROnUrl(string thisDecode)
{
thisDecode = thisDecode.Replace("", "+");
return Decrypt(HttpUtility.UrlDecode(thisDecode));
}
}
<ItemTemplate>
<asp:HyperLink ID="EditPass" Font-Underline="false" runat="server" ImageUrl="~/Image/GridV/company_pencil.png" NavigateUrl=<%#String.Format("javascript:OpenPopupModal('EditCopmany.aspx?id={0}','315px','150px','450px','640px')", QueryDecodeandEncode.encodeSTROnUrl(Eval("FCompanyID").ToString())) %> />
<itemstyle width="60px" horizontalalign="Center" verticalalign="Middle" />
</ItemTemplate>