1
votes

My .Net MVC Azure webapp site has two folders which serve static content from the root of the site.

/docs   (PDF,docx etc)

and

/images  (jpg,gif,png etc)

both folders contain files in a hierarchical structure(folders i.e. public, logos etc.).

If I store these files in blob storage can I "map" a virtual directory to storage containers or is URL rewrite the most efficient option?

Also I've tried uploading files using azure storage explorer to a container (docs) and notice there doesn't seem to be a way of storing it hierarchically. Does this mean I would need to create a blob container for each sub-folder, and add URL rewrite rules for each potential folder?

1

1 Answers

1
votes

If I store these files in blob storage can I "map" a virtual directory to storage containers or is URL rewrite the most efficient option?

I'm not sure if you can map a virtual directory but what you can do is associate a custom domain to your blob storage. So you could possibly create "staticontent.yourwebsite.com" and map that to your blob storage. Please see this link for more details: https://azure.microsoft.com/en-in/documentation/articles/storage-custom-domain-name/.

Also I've tried uploading files using azure storage explorer to a container (docs) and notice there doesn't seem to be a way of storing it hierarchically. Does this mean I would need to create a blob container for each sub-folder, and add URL rewrite rules for each potential folder?

Natively blob storage doesn't support the concept of folders and subfolders. It essentially has 2-level hierarchy: blob containers & blobs. But that doesn't mean you have to create a blob container for each folder. However you can create an illusion of folder hierarchy by prefixing the name of your folder to your file's name. Some storage explorer tools do that automatically for you (unfortunately Azure Storage Explorer is not one of them :(). Give Cerebrata Azure Explorer a try. Using it you should be able to upload folders from your local computer to a blob container while maintaining the folder structure.