In this article, we are trying to experiment the local storage feature of
Windows Azure. From the previous article we found that local storage is one of
the primitive storage mechanisms in Windows Azure.
The core features of Local Storage are:
- Temporary Storage
- Feature provided by the Operating System
- Similar to Hard Drive
- Exposed as logical file system
- .Net Directory/File IO Framework used to
- Can be used for storing Cache items
Creating a Local Storage
Here we are creating a local resource through the step by step activities.
Step 1: Create new Web Role project
You will be familiar with web role creation and you can repeat the same. After
the solution is created, the Solution Explorer will be looking like below:
Step 2: Open the local storage pane
Now double click on the WebRole1 item shown above to open the project
configuration, Form there click the Local Storage pane item.
Step 3: Add a new Local Storage item
Add a new local storage items by clicking the Add Local Storage button. Rename
it to TestStorage Change the Size to 10 MB as shown in the figure and save the
The above change will modify the configuration file of the application.
Step 4: Show Information about the Local Resource
Now we can place a label on the page, rename it to InfoLabel. Then on the page
load event we can access the local resource and show the properties it has.
The RootPath property gives the current path of the resource in machine.
The MaximumSizeInMegabytes property returns the size allocated to it.
On executing the application we can see the following output.
Step 5: Start using the folder
Now we can use the above folder for our storage purpose. We can create folder,
files inside it.
Create a new button on the page and name it as CreateFolderAndFileButton. On
click of the button place the code to create a directory and file.
"Directories inside it: <br>";
InfoLabel.Text += dir +
"<br>Files inside it";
InfoLabel.Text += file +
Execute the application and on clicking the button we can see the following
In this article we have found how to use the local storage feature of Windows
Azure and creating folder and file inside it.