c# making http put request to azure storage -
Hi I wonder if blue blob service can be called using API
C # ID wants to upload a file such as the word document on the storage space, the http method "puts" and the rest of the url
""
will this code work?
string user name = "user"; String password = "password"; String Data = "Path to Word Document;
HTTP WebBurwer Request = (HTTP WebBarm) WebRequest.CRETE (URL); Request method =" Pt "; Request Credentials = New Network Credentials (UserName, Password); Request.ContentLength = data.Length; request.ContentType = "text / plain" (StreamWriter author = new streamer (request.GetRequestStream ())) {writer.WriteLine (data);} WebResponse Response = request.GetResponse (); (StreamReader Reader = using new streammorder (response.GetResponsestream ()) {while (re Ader.Peek ()! = -1) {Console.WriteLine (reader.ReadLine ());
No, this will not work. Authentication for Windows Azure storage involves signing the header of the request.)
Note that the .net storageclient library with SDK is redistributable , So you can add a reference to it (from memory):
CloudStorageAccount .Parse ("& lt; Connection String & gt; ") .CreateCloudBlobClient () .GetBlobReference (" mycontainer / myblob "). Upload Battery (Data);
Comments
Post a Comment