This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Calling Sav32Cli.exe from asp.net c# application "Code 2 - If some error preventing further execution is discover "

Hello Everyone,

I have integrated Sav32Cli.exe in my asp.net c# application & its working fine in my local machine but when we move it on the testing server I am getting the following error "Code 2 - If some error preventing further execution is discover "

The scenario is If only 1 person performs the activity it works fine but concurrent connection performs the same activity then I am getting this error for some connections.

Actual scenario : We have the page where users upload the pdf file & as soon as the file is uploaded on the server we perform the scanning via sop-hos and when multiple users perform the same activity I am getting the following error : Code 2 - If some error preventing further execution is discover. So I would like to know from you guys when should I do to bypass this error & implement the scanning successfully into my application.

Below is the code I have written to integrate the scanning into my application : 

 

System.Diagnostics.Process process = new System.Diagnostics.Process();
        System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
        try
        {
 
            string filePath = sFileDetails.DirectoryName + "\\" + sFileName;
 
            startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
            startInfo.FileName = "C:\\Program Files (x86)\\Sophos\\Sophos Anti-Virus\\sav32cli.exe";
            startInfo.Arguments = String.Format(@" -ss ""{0}""", filePath); 
            process.StartInfo = startInfo;
            process.StartInfo.Verb = "runas";
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.UseShellExecute = false;
            process.Start();
 
            string output = process.StandardOutput.ReadToEnd();
 
            StringBuilder objStrBuilder = new StringBuilder();
            objStrBuilder.AppendLine("Status  " + output.ToString());
 
            int i = process.ExitCode;
 
            objStrBuilder.AppendLine("Code " + i.ToString());
            File.WriteAllText(sFileDetails.DirectoryName + "\\" + Convert.ToString(System.Guid.NewGuid()) + ".txt", Convert.ToString(objStrBuilder));
            
            if (i > 0)
            {
                return false;
            }
 
            return true;
        }
        catch (Exception ex)
        {
            return false;
        }
        finally
        {
            process.Close();
            process.Dispose();
        }


This thread was automatically locked due to age.
Parents Reply Children