samule
samule

Reputation: 41

Create a cloud storage app with ASP.NET and Azure

I need to create a cloud storage application using ASP.NET MVC, C# and integrate it with Azure storage.

I currently have a functional interface which allows users to register and securely stores their details in an SQL database. I also have a basic file uploader using Azure Blob storage that was created using this tutorial as a guideline.

My question regards how to give users their own container/page so that their files are only accessible by them. At the moment, the file uploader and Azure container is shared so that anybody with an account can view and edit the uploads. I want to restrict this so that each user has their own individual space that cannot be read or modified by others.

I have searched for answers but cannot find anything that suits my needs. Any advice would be greatly appreciated.

Upvotes: 2

Views: 1989

Answers (2)

Gaurav Mantri
Gaurav Mantri

Reputation: 136136

My question regards how to give users their own container/page so that their files are only accessible by them.

One way to achieve this is by assigning a container to a user. When a user signs up, as a part of registration process you create a blob container for the user and store the name of the container along with other details about the user. When the user signs in, you fetch this information and only show files from that container only. Similarly when the user uploads the files, you save the files in that container only.

A few things you would need to consider:

  • You can't set any hard limit on the size of the container. So a container can be as big as a size of your storage account. If you want to put some restrictions on how much data a user can upload, you would need to manage that outside of storage in your application. You may also want to look into Azure File Service if that's a requirement. In Azure File Service, you can restrict the size of a share (equivalent of a blob container).
  • You may even want to load-balance your users across multiple storage accounts to achieve better throughput. If you decide to go down this route then along with container name, you would also need to store the storage account name along with user information.

Upvotes: 2

Jace
Jace

Reputation: 817

Store the document names in a separate SQL database linked to the user's account. Then display to the user only those files with filenames linked specifically to them, and you should be on your way! I've used this architecture before, and it works like a charm. You should attach a Guid or some other unique identifier to each filename before implementing this model, however.

Upvotes: 0

Related Questions