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();
}