Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run a Virus Scan While Uploading files in ASP.NET

I have developed a web based application in ASP.NET and C# where users have the facility to upload files on the server through this application I want the application to Scan the uploaded files for viruses before saving on the server. Same like when we attach files with our email in Yahoo. Please guide me how I can achieve this functionality Any API which can be integrated in ASP.NET application or any other way you can suggest. We can purchase the licensed version of a product which can achieve this. I have googled but did not find specific results.

Thanks in advance!

like image 923
code master Avatar asked Dec 23 '10 16:12

code master


People also ask

How do I scan with ClamAV?

Scan Files for Viruses with ClamAV This translates to the following command on the terminal: “clamscan -r --bell -i /home/bill/Downloads”. To scan the whole system (it may take a while) and remove all infected files in the process, you can use the command in the following form: “clamscan -r --remove /”.


2 Answers

First of all the file must be saved onto the server before you can scan it. If you notice Yahoo will upload the file first - but not allow the attachment to be sent until scanned.

Then you can use an antivirus with a command line interface or some other kind of API. Both of these can be called via C# and should provide the functionality you require. Parhaps write a wrapper class that takes a file and returns true or false depending on whether a virus was detected.

like image 181
m.edmondson Avatar answered Oct 26 '22 14:10

m.edmondson


Other applications that provide you with a command line interface:

  1. Microsoft Security Essentials
  2. clamAv

I believe MS AV provides better results.

like image 29
OSH Avatar answered Oct 26 '22 14:10

OSH