Azure Blob Storage In ASP.NET Core 2.0

Problem

How to use Azure Blob storage in ASP.NET Core.

Solution

Create a class library and add NuGet package - WindowsAzure.Storage

Add a class to encapsulate settings,

Add a class to encapsulate a blob item,

Now add public methods to upload and download blob items,

Add methods to get a list of blob items,

Inject and use storage helper,

Note

Sample code has a controller with actions for listing, downloading and uploading items.

In ASP.NET Core Web Application, configure services,

Discussion

The sample code will require you to set up an Azure account, blob storage account, and container. Instructions for these can be found  here.

Source Code

GitHub

Up Next
    Ebook Download
    View all
    Learn
    View all