views:

87

answers:

2

I have the need to integrate some blob storage into an existing ASP.NET Mvc site

my hope is to be able to just add some references and then just do puts and gets

but I cannot find any simple example for how to do this (that hasn't been depricated to the point it no longer works)

I have tried using StorageClient but CreateCloudBlobClient() doesn't seem to work.

+2  A: 

Windows Azure Platform Training Kit has a guestbok demo that shows how to do that, its simple as:

// upload the image to blob storage
CloudBlobContainer container = blobStorage.GetContainerReference("guestbookpics");
string uniqueBlobName = string.Format("image_{0}.jpg", Guid.NewGuid().ToString());
CloudBlockBlob blob = container.GetBlockBlobReference(uniqueBlobName);
blob.Properties.ContentType = FileUpload1.PostedFile.ContentType;
blob.UploadFromStream(FileUpload1.FileContent);

You can download it at: http://www.microsoft.com/downloads/details.aspx?FamilyID=413e88f8-5966-4a83-b309-53b7b77edf78&displaylang=en

L. Cooper
A: 

Just an additional consideration:

Depending on the content you store in the blobs and what kind of processing you need to do, you might be able to reference data directly from the web page.

The advantages of this model is that it offloads the web server from tunneling the content. You can also take advatnage of Windows Azure CDN.

BTW, this post explains this in more detail: Azure storage + shared access signatures

Eugenio Pace