MarkKGreenway
MarkKGreenway

Reputation: 8754

Simplest Azure Storage Manipulation possible

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 deprecated to the point it no longer works)

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

Upvotes: 0

Views: 334

Answers (3)

Eugenio Pace
Eugenio Pace

Reputation: 14212

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

Upvotes: 0

codingoutloud
codingoutloud

Reputation: 2155

There is also an annotated example of Programming Windows Azure Blob Storage in One Page of Code (which I wrote many months ago - but a few months after your question was posted - but perhaps it will help someone else).

Upvotes: 0

user120929
user120929

Reputation:

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

Upvotes: 4

Related Questions