Skip to main content

Programmatically create a Zip Archive file and send it as ActionResult using native ASP.NET MVC C#

If you’re working with ASP.NET or ASP.NET Core and you need to create a zip file on-the-fly within your controller – for example to allow the user to download multiple files with a single request – you can easily do that using the ZipArchive class, introduced in Framework 4.5.

Here’s a quick code sample using a MemoryStream and a couple of byte arrays representing two files:

Read More

WannaCry: how to check if your system is protected using a PowerShell script

If you’ve stumbled upon this post you are probably well-aware of the Win32/WannaCrypt Ransomware, better known as WannaCry: we already talked about it in this other post, which contains an extensive list of links to download the various patches to shield almost any Windows-based operating system against this dangerous treat.

However, you might also need to find a way to quickly check if your system is effectively protected against WannaCry or not: this could come very handy if you are a System Administrator and you don’t know which server is missing the updates or not. Altough the best suggestion we can give would always be “patch everything”, you can also use this great PowerShell script (which we stole from this great post from SpiceWorks community site – credits to CarlosTech for the great job):

Read More

WannaCry Malware Official Patches – All Windows Versions from Microsoft Technet

If you stumbled upon this post you most certainly know about the recent Ransomware called Ransom:Win32/WannaCrypt, better known as WannaCry, and you want to know if your system is immune to it. To keep it short, there’s a high chance you already are… as long as you patched your OS on regular basis. The SMB Vulnerability Jump which has been exploited by WannaCry/WannaCrypt has been patched since March 2017 and distribuited through the standard Windows Update feature.

If you didn’t patch – as most international companies who have been impacted – you should really spend some valuable time in doing that just now by going to the official Technet resource page for MS17-010 Jump. There you will find all patches for all Windows versions including Windows 10, Windows Server 2003, Windows Server 2008, Windows Server 2012, Windows Server 2012 R2 and Windows Server 2016.

As soon as you did that, you might also want to do the following, as suggested by this other Technet blog post:

  • Check if your system is protected using this Powershell script in order to ensure that you performed the update properly.
  • Block SMB incoming connections (Port 445) from External – Internal Network on Edge Firewalls
  • Upgrade legacy systems to latest OS (Windows 10 , Better Inbuilt protections – Credential Guard, Device Guard, Memory Protections, Secure Kernel, VBS, Edge Browser etc).
  • Microsoft just released emergency security updates/fixes for legacy systems as well (Windows XP , Server 2003 etc). Download links are below (and also in the aforementioned Technet page).

For additional technical info about the malware, I can only suggest reading the following posts from MMPC, FireEye and Technet:

And these are the links for legacy systems:

Read More

MS Office 2016 and 365 official ISO IMG images for download & offline install (product key required)

Let’s make it clear, this is not warez or pirate software. What we’re giving here is merely a list of links to the official Microsoft MS Office 2016 RTM distributions offline installers (and embedded applications, such as: Word, Excel, Access, Outlook, PowerPoint, Project and Visio) based upon Microsoft’s Click-To-Run technology, which you can get for free by logging to any valid MS account.

These links can be very useful for those System Administrators who need to perform batch installs, backups or digital storage without having the physical supports at hand.

Needless to say, in order to install the software you need a valid Product Key (not included), which you can purchase in the Microsoft Store or from any official reseller.

UPDATE: If you’re also looking for MS Windows ISO images (Windows 7, Windows 8.1 & Windows 10, all releases and builds), click here.

Read More

80070005 Access is denied error while accessing Word Interop from the Server in a ASP.NET Application – How to fix

Last week I published a couple post regarding the use of the Microsoft.Office.Interop.Word namespace within an ASP.NET C# Application, respectively about opening a DOC or DOCX file from a Byte Array and converting them to PDF files. Although these techniques can be very useful to deal with MS Word documents, they have more than a couple drawbacks that we should always take into consideration when using them:

  • They are often painfully slow and inefficient, especially when dealing with huge amount of files (batch processing).
  • They consume a massive amount of memory – considering the task given to them.
  • They have a terrible multi-thread support, to the point that they might lead to scale/concurrency issues.
  • They do require MS Office installed where we use them.
  • They do require an awful set of permissions to allow the IIS users to access the required DCOM components the IIS.

I’m not saying we shouldn’t use them: as a matter of fact we kinda have to, unless we want to donate a kidney to some commercial libraries that can handle these tasks in a much better way. At the same time, we should get ready to experience some issues because they will create some havoc here and there sooner or later.

Read More