我使用的ASP中繼器顯示的圖像,我希望對它進行加密,但我不知道如何解密每次中繼火項目解密repeater項目使用的ItemDataBound
//client side <asp:Repeater ID="Repeater1" runat="server" OnItemCommand="Repeater1_ItemCommand" OnItemDataBound="Repeater1_ItemDataBound" >
`//server side
//decrypt method
private void DecryptFile(string inputFile, string outputFile)
{
{
string password = @"myKey123"; // Your Key Here
UnicodeEncoding UE = new UnicodeEncoding();
byte[] key = UE.GetBytes(password);
FileStream fsCrypt = new FileStream(inputFile, FileMode.Open);
RijndaelManaged RMCrypto = new RijndaelManaged();
CryptoStream cs = new CryptoStream(fsCrypt,
RMCrypto.CreateDecryptor(key, key),
CryptoStreamMode.Read);
FileStream fsOut = new FileStream(outputFile, FileMode.Create);
int data;
while ((data = cs.ReadByte()) != -1)
fsOut.WriteByte((byte)data);
fsOut.Close();
cs.Close();
fsCrypt.Close();
}
}
`
protected void Repeater1_ItemDataBound(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName =="openimage")
{
string[] commandArgs = e.CommandArgument.ToString().Split(new char[] { ',' });
DecryptFile(commandArgs[0], commandArgs[0]);
}
}
當我嘗試運行它,它給我的錯誤CS0123:沒有重載「Repeater1_ItemDataBound」匹配委託「System.Web.UI.WebControls.Repeater ItemEventHandler」
請幫助我,因爲我是新來的C#