Using Wisej.NET to Access Blob Storage with Microsoft Azure

by Iulia Pitutiu

This document describes how you can benefit from using Azure files in your .NET web application.

During a web-enabling process, one of our standard tasks that we analyze with our customers revolves around file management. Our experience has proven that desktop applications heavily use file manipulation, therefore we need to provide modern options to support this feature within web-enabled applications.


Wisej.NET Framework is very flexible and extensible when it comes to file handling. It provides an abstract interface for file access enabling customers to use any file system that their web applications need: either the built-in default implementation for the standard disk-based file system or several alternative implementations for cloud-based file storage.

Nowadays, it is attractive to deploy web applications to an environment like Microsoft Azure. Therefore, it makes sense to use an Azure file integration as a supplement or total replacement for traditional on-premise file servers.

How to Use Azure Blob Storage with Wisej.NET

In this article, I am describing the way a Wisej.NET web application can interact with cloud files stored on Microsoft Azure Blob Storage. To connect your web application to Azure Blob Storage, there are a couple of easy steps to follow.


  • Azure subscription

  • Azure storage account

  • Install Azure.Storage.Blobs 12.10 library in your solution:

  • Install System.Runtime.CompilerServices.Unsafe version 4.6.0:

    The Compiler Services will require a binding redirect in the Web.config file:

  • Install System.Buffers version 4.5.1:

The System.Buffers will require a binding redirect in the Web.config file:

The Implementation of AzureBlobProvider

The file system implementation for the Azure Blob storage needs to be placed in a class that implements the Wisej.NET IFileSystemProvider, I named my new class AzureBlobProvider:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Wisej.Core;
using Azure.Storage.Blobs;
using Azure.Storage.Blobs.Models;
using System.Threading.Tasks;
using System.Text;
using System.IO;
using System.Configuration;
using System.ComponentModel;
using System.Drawing;
using System.Text.RegularExpressions;
using Azure;

namespace AzureBlobStorageSample
    /// <summary>
    /// Implementation of the Azure Blob Storage provide.
    /// Provides access to the Azure Blog Storage as a file system.
    /// </summary>
    public class AzureBlobProvider : IFileSystemProvider
        /// <summary>

The authentication to the Blob storage can be done in many ways like the Microsoft documentation indicates – the actual authentication is not in the current scope of this article, but rather the file access part is more relevant. Independent of the authentication type, for the actual Azure Blob storage connection, we need to know the account and container name – which is stored in our AzureBlobProvider class members:

/// </summary>
public string AccountName
    get { return this.accountName; }
        if (string.IsNullOrEmpty(value))
            throw new ArgumentNullException("accountName");
        this.accountName = value.Trim();
private string accountName;

/// <summary>
/// Returns or sets the name of the Azure Blob Container
/// </summary>
internal string BlobContainer
    get { return this.blobContainer; }
        if (string.IsNullOrEmpty(value))
            throw new ArgumentNullException("blobContainer");
        this.blobContainer = value.Trim();
private strong blobContainer;

Scenario 1: Import Operation

For a standard import operation, the end user should be able to select the file path from the Azure storage. To achieve the file import, I have used a Wisej.NET Open File Dialog where I added both a local folder and an Azure Blob storage container just to show case that both file systems can be used together:

private void btOpenFile_Click(object sender, EventArgs e)
    var fileContent = string.Empty;
    var filePath = string.Empty;
    using (OpenFileDialog openFileDialog = new OpenFileDialog())
        openFileDialog.Title = "Select file to import";
        openFileDialog.Roots.Add(new FileSstemProvider("\\network shared path\subpath01\...  ", "My Local Files"));
        openFileDialog.Filter = "Text Files (*.txt)|*.txt|CSV Files (*.csv)|*.csv|XML Files (*.xml)|*.xml";
        openFileDialog.FilterIndex = 3;
        openFileDialog.AddExtension = true;

        if (openFileDialog.ShowDialog() == DialogResult.OK)
            txtImportFilePath.Text = openFileDialog.FileName;

If we run the sample, the user is prompted with a file picker dialog – as shown, the Azure Blob Storage folder structure is displayed:

This is possible because the Wisej.NET Open File Dialog calls GetDirectories and GetFiles methods from our AzureBlobProvider class:

For displaying the file properties, the AzureBlobProvider class implements methods like GetFileSize or GetCreationTime.

After the user selects the imported file, the web application may require processing the file content. On the server side, this operation means downloading the Azure Blob item and reading its content.

The implementation for downloading and reading a Blob item’s content is here:

Scenario 2: Export Operation

Another common scenario is when the web application is generating a report which should be uploaded to either a pre-defined or a user-defined Azure location. To simulate the export, in my sample, you can type in the file content and then click the Upload button:

After clicking the Upload button, the Save File Dialog allows you to specify the location and the name of your file:

The result will be uploaded in Azure Storage:


Wisej.NET is a very powerful web application framework which enables taking advantage of the latest .NET technologies.

For further examples on how to implement cloud storage file access, I recommend the Amazon S3 file system implementation provided by ITG, which was also my support for developing the Azure Storage file system provider.

wisej-extensions · iceteagroup/wisej-extensions (

Last updated


© Ice Tea Group LLC, All Rights Reserved.