How to Block Zero Day Threats in C# .Net Framework

Install-Package Cloudmersive.APIClient.NET.VirusScan -Version 3.0.3
using System;using System.Diagnostics;using Cloudmersive.APIClient.NET.VirusScan.Api;using Cloudmersive.APIClient.NET.VirusScan.Client;using Cloudmersive.APIClient.NET.VirusScan.Model;namespace Example{public class ScanFileAdvancedExample{public void main(){// Configure API key authorization: ApikeyConfiguration.Default.AddApiKey("Apikey", "YOUR_API_KEY");// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed// Configuration.Default.AddApiKeyPrefix("Apikey", "Bearer");var apiInstance = new ScanApi();var inputFile = new System.IO.Stream(); // System.IO.Stream | Input file to perform the operation on.var allowExecutables = true;  // bool? | Set to false to block executable files (program code) from being allowed in the input file.  Default is false (recommended). (optional)var allowInvalidFiles = true;  // bool? | Set to false to block invalid files, such as a PDF file that is not really a valid PDF file, or a Word Document that is not a valid Word Document.  Default is false (recommended). (optional)var allowScripts = true;  // bool? | Set to false to block script files, such as a PHP files, Pythong scripts, and other malicious content or security threats that can be embedded in the file.  Set to true to allow these file types.  Default is false (recommended). (optional)var allowPasswordProtectedFiles = true;  // bool? | Set to false to block password protected and encrypted files, such as encrypted zip and rar files, and other files that seek to circumvent scanning through passwords.  Set to true to allow these file types.  Default is false (recommended). (optional)var restrictFileTypes = restrictFileTypes_example;  // string | Specify a restricted set of file formats to allow as clean as a comma-separated list of file formats, such as .pdf,.docx,.png would allow only PDF, PNG and Word document files.  All files must pass content verification against this list of file formats, if they do not, then the result will be returned as CleanResult=false.  Set restrictFileTypes parameter to null or empty string to disable; default is disabled. (optional)try{// Advanced Scan a file for virusesVirusScanAdvancedResult result = apiInstance.ScanFileAdvanced(inputFile, allowExecutables, allowInvalidFiles, allowScripts, allowPasswordProtectedFiles, restrictFileTypes);Debug.WriteLine(result);}catch (Exception e){Debug.Print("Exception when calling ScanApi.ScanFileAdvanced: " + e.Message );}}}}

--

--

--

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Create and Synchronize Microsoft Azure Inventory with Ansible Tower.docx

OrionLab | OrionLab.io | Orionlab Logo | Cloud Automation Experts

Pattern identification — an essential step in the discovery process

A Newbie’s Experience at ForloopPH 2.0

1.1 What is C# and .NET?

Shell (project simple shell)

Coding Made Easy: Use Jupyter Notebooks on Smartphones.

What is Ruby on Rails?

PANDAS

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cloudmersive

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

More from Medium

Query an XML file using XQuery, Get Results in C#

C# Loops vs Parallel Foreach

How to return more than one value from the function in C#.

c# async-await common usages