19

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!

code master
  • 2,006
  • 4
  • 30
  • 48
  • 1
    thought this might be useful http://www.symantec.com/connect/articles/how-use-symantec-scan-engine-52-content-scanning-technologies-direct-integration-your-appli – Bala R Dec 23 '10 at 16:23
  • I see this article as you said it return true or false. This is just FYI.. and not sure if this compatible to dot net application.. Sorry if it is a spam. http://www.developer.com/design/article.php/3711331/Implementing-an-Anti-Virus-File-Scan-in-JEE-Applications.htm –  Sep 19 '11 at 05:30
  • You can use IAttachmentExecute API. [This answer you can help you](http://stackoverflow.com/a/35684198/1442180) – Fred Feb 29 '16 at 15:26

3 Answers3

2

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.

m.edmondson
  • 28,523
  • 26
  • 113
  • 191
1

Other applications that provide you with a command line interface:

  1. Microsoft Security Essentials
  2. clamAv

I believe MS AV provides better results.

Vahid Farahmandian
  • 5,079
  • 5
  • 38
  • 54
OSH
  • 2,578
  • 2
  • 20
  • 45
0

Just purchase antivirus software that has a command-line interface (several popular packages include this). Once the file has been uploaded, run the scan.

I would think, in order to upload and scan at the same time, you might need to implement your own antivirus software as I'm not familiar with any package that would provide that sort of interface.

I run a shareware site. It doesn't work as you described, but I download each file to my local computer and run a scan on them. You would be doing something similar.

Jonathan Wood
  • 59,750
  • 65
  • 229
  • 380