-1

We have an application that we would like to migrate to Azure.There is a requirement in which a virtual temporary folder is created if not exist and a dynamic html page is to be created based on some user input which has been done in asp.net previously.How this can be achieved in azure web role.

I tried this requirement by adding a folder name called "Preview" and generated the html file under the preview folder.This works fine in the development machine(local). But it is throwing an exception in the live environment like Directory Not found Exception (E:\siteroot\0\preview\previewbasic.htm).

I would like to preview the html page which was created dynamically in the preview folder if we specify the url in the browser as [siteurl].cloudapp.net/preview/preview.htm.

My question is 1.Can we create a dynamic folder called "preview" in azure web role. 2.Can we generate a html file say(preview.htm) under this folder in web role. 3.Can this file be accessed as [siteurl].cloudapp.net/preview/preview.htm

I hope the question is somewhat clear now. Any help would be much appreciated.

Jovial Andree
  • 73
  • 1
  • 10

1 Answers1

2

The local file system is not advised for Web Roles due to the fact that the storage is not guaranteed to be persistent -- if the web role is created using another VM then the files created in another instance will not be available. Therefore, you are better off using Azure Blob Storage. Files created via Blob Storage would be available among all instances of the Web Role.

Answers to your questions:

  1. Create the container in Azure Blob Storage
  2. Yes you could create the html and save it to the container created
  3. You could make the URI for this blob public and then access it via your custom URL -- you'd have to create a CNAME for the storage container first.

Here is a good resource on how to use Blob Storage from .NET:
http://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-blobs/

Scott Prokopetz
  • 474
  • 3
  • 6
  • Thanks Scott for your support.. But i managed to create a static folder and read the files which was created dynamically. – Jovial Andree Jul 21 '14 at 16:36