0
我有一个ajax上传器允许用户上传图片到程序,然后显示回用户。我希望在允许文件留在服务器之前检查该文件是否有病毒。以下是将文件发送到病毒扫描程序的代码。我希望能够看到扫描结果是否会产生病毒,然后如果确实有病毒,请将其从服务器上删除。如何检查asp.net c#中的病毒扫描结果?
try
{
Process myProcess = new Process();
myProcess.StartInfo.FileName = @"C:\Program Files\AVG\AVG8\avgscanx.exe";
//[email protected]"C:\Program Files\ClamWin\bin\clamscan.exe";
string myprocarg = @"""C:\Documents and Settings\Administrator.USER20501\My Documents\Luke's Projects\DADS\212\Images\FinalLogo" + file.ClientFileName + @"""";
myProcess.StartInfo.Arguments = myprocarg;
myProcess.OutputDataReceived += new DataReceivedEventHandler(myProcess_OutputDataReceived);
myProcess.ErrorDataReceived += new DataReceivedEventHandler(myProcess_ErrorDataReceived);
myProcess.StartInfo.RedirectStandardOutput = true;
myProcess.StartInfo.RedirectStandardError = true;
myProcess.StartInfo.UseShellExecute = false;
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start();
myProcess.BeginOutputReadLine();
myProcess.WaitForExit();
}
catch (Exception)
{
}
void myProcess_OutputDataReceived(object sender, DataReceivedEventArgs e)
{
// this value will always be null.......
string s = e.Data.ToString();
}
void myProcess_ErrorDataReceived(object sender, DataReceivedEventArgs e)
{
string s = e.Data.ToString();
}