25405

How do I extract “eTag” or “x-ms-request-id” from my Astoria DataContext response?

Question:

The Azure table whitepaper mentions that the x-ms-request-id is useful to send to Microsoft in the event there is an error working with the data. If I do have such an error, I'd like my try...catch block to take this and save it somewhere for future analysis.

In addition I need to extract the ETag value as well while in Table storage.

How do I extract this information and have it available when the Exception comes around?

HTTP/1.1 204 No Content Content-Length: 0 ETag: W/"datetime'2008-10-01T15%3A27%3A34.4838174Z'" x-ms-request-id: 7c1b5e22-831d-403c-b88a-caa4443e75cb

Answer1:

Depends on your client implementation, but they are all HTTP 1.1 headers.

For example, ( Assuming .NET WebRequest Class ) something like:

WebRequest request = WebRequest.Create("http://myazurestore.server.com"); .... WebResponse response = request.GetResponse(); string mSRequestId = response.Headers["x-ms-request-id"];

Would work

<em>EDIT(for Storage Client Lib) .</em>..

If you are using the Client library, you can get at ETag from the Properties collection on CloudBlob

So ..

Cloudblob blob = container.GetBlobReference("blobname.ext"); var eTag = blob.Properties.ETag

Properties is a blobProperties object. It should provide access to most of the needed data.

MSDN: <a href="http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storageclient.blobproperties_members.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storageclient.blobproperties_members.aspx</a>

Answer2:

You may want to check out my open source Azure Table Storage Client project on CodePlex.

<a href="http://lucifurestash.codeplex.com/" rel="nofollow">Lucifure Stash</a> allows easy access to the ETag as well as the HttpWebRequest and HttpWebResponse objects.

Recommend

  • Calculating a rolling count over a specified window
  • MomentJS - convert datetime from UTC to different timezone
  • Exception when deploying on glassfish: ArrayIndexOutOfBoundsException: 9578
  • RavenDB indexing errors
  • Does CSS support inheritance [duplicate]
  • Pass array from parent template to child template
  • Access object instance inside an event handler
  • PayPal API Listener Website Payments Standard URI
  • C# - Most efficient way to iterate through multiple arrays/list
  • How to load gif image while ajax content is loading and javascript [duplicate]
  • Use tryCatch within R loop
  • converter json to two dimensional array
  • Eclipse MTJ doesn't see Java ME SDK 3.0 devices
  • Can I read an iPhone beacon with Windows.Devices.Bluetooth.Advertisement.BluetoothLEManufacturerData
  • Ajax Upload File: $_FILES is empty but files exists in request header
  • JBoss External Properties Files in Classpath
  • Appending Character to Character Array In C
  • How to convert workspace coordinates to screen coordinates?
  • How can I extract results of aggregate queries in slick?
  • Declaring variable dynamically in VB.net
  • Mysterious problem with floating point in LISP - time axis generation
  • ActiveRecord query for a count of new users by day
  • How do I alternate colors in Flat List (React Native)
  • Illegal mix of collations for operation for date/time comparison
  • DotNetZip - Calculate final zip size before calling Save(stream)
  • AES padding and writing the ciphertext to a disk file
  • How to convert from System.Drawing.Color to Excel.ColorFormat in C#? Change comment color
  • javascript inside java/jsp code
  • bootstrap to use multiple ng-app
  • retrieve vertices with no linked edge in arangodb
  • How to get icons for entities from eclipse?
  • Android Studio and gradle
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • Change div Background jquery
  • Turn off referential integrity in Derby? is it possible?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • apache spark aggregate function using min value
  • JaxB to read class hierarchy
  • How can i traverse a binary tree from right to left in java?
  • How can I use threading to 'tick' a timer to be accessed by other threads?