In this blog post, we will integrate ASP.NET MVC with Azure BLOB Storage by saving an image for an ASP.NET Identity 2.0 user in Azure BLOB Storage. We’re going to cover a lot of ground in this post, including:
- Using ASP.NET Identity 2.0 user as reference in other table.
- Creating a one to many relationship with ASP.NET Identity 2.0 user table
- Connecting an ASP.NET MVC application to Azure Storage
- Creating or Uploading a BLOB
- Deleting a BLOB
- Downloading a BLOB
- Uploading a file from MVC form to a Azure BLOB
The final output of the blog post we plan on creating in this post will look more or less like the image below. As you can see, a user can upload a photo to her album, delete a photo, and of course, view photos too.
Architecture of the Application
The High-level architecture of the application can be drawn as shown in the image below:
Creating tables to save images
When we create an ASP.NET MVC application using the given MVC template in Visual Studio, by default, a basic authentication gets created using the ASP.NET Identity 2.0. In a default MVC project, a template for the authentication and authorization purpose ASP.NET Identity 2.0 creates the tables as shown in the image below: