Coffeehouse Thread

8 posts

Scan the files for viruses automatically in ASP.NET and C#.NET

Back to Forum: Coffeehouse
  • User profile image
    satish ch

    Hello,

    We have a file upload feature in one of our websites developed in ASP.NET and C#.NET. We would like to scan the files for viruses automatically before they are being uploaded into our server. We are using AVG server edition on our server. How can we enable this feature. Any help would be appreciated.

    Thanks
    Satish Ch.

  • User profile image
    DCMonkey

    Scan them before they're uploaded? Are you sure you've given that concept enough thought?

     

    On the other hand, if you want to scan  them before putting them in their final location on your server you could upload them to a temporary folder and call your AV software's command line scanner on them.

  • User profile image
    ZippyV

    DCMonkey said:

    Scan them before they're uploaded? Are you sure you've given that concept enough thought?

     

    On the other hand, if you want to scan  them before putting them in their final location on your server you could upload them to a temporary folder and call your AV software's command line scanner on them.

    Shouldn't the files be automatically scanned?

  • User profile image
    DCMonkey

    ZippyV said:
    DCMonkey said:
    *snip*

    Shouldn't the files be automatically scanned?

    Probably, but maybe he would want to be able to report to the user if their file was rejected by the scan. The default scan record would likely just be in some log somewhere.

  • User profile image
    Ion Todirel

    DCMonkey said:
    ZippyV said:
    *snip*

    Probably, but maybe he would want to be able to report to the user if their file was rejected by the scan. The default scan record would likely just be in some log somewhere.

    Probably not, having antivirus software (actively scanning in background) on a server would be a huge hit. You need all the performance you can get.

  • User profile image
    W3bbo

    Ion Todirel said:
    DCMonkey said:
    *snip*

    Probably not, having antivirus software (actively scanning in background) on a server would be a huge hit. You need all the performance you can get.

    Pretty much every AV software has a command-line mode where you can get it to scan a single file in one operation (it's how Messenger uses AV, for example), scanning shouldn't take more than a second for every 10MB of data to look through.

     

    So assuming uploads aren't happening at more than a few per minute the system should cope fine.

     

  • User profile image
    kettch

    Ion Todirel said:
    DCMonkey said:
    *snip*

    Probably not, having antivirus software (actively scanning in background) on a server would be a huge hit. You need all the performance you can get.

    Depending on their needs, it might be a good idea to send the uploads directly to a staging server to do the scans. Then it could be sent on to its final destination from there. That would keep the load off of the web server.

  • User profile image
    ManipUni

    Several AV solutions have a command line scanner that you can call from code and monitor the output. If it returns 0 then the file is clean, if text is returned then you can isolate the file and forward on the text. Try ClamAV

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.