When copying headers from a blob to a HttpContentHeader collection like this:
response.Content.Headers.ContentLength = blob.Properties.Length;
i was wondering if there was a way to get all the raw headers from CloudBlobBlob instead of copying them over like above
Will this work for you?
static void ReadBlobProperties()
{
var cloudStorageAccount = CloudStorageAccount.DevelopmentStorageAccount;
var blobClient = cloudStorageAccount.CreateCloudBlobClient();
var container = blobClient.GetContainerReference("container-name");
var blob = container.GetBlockBlobReference("blob-name");
OperationContext opContext = new OperationContext();
opContext.RequestCompleted += opContext_RequestCompleted;
BlobRequestOptions requestOptions = new BlobRequestOptions();
blob.FetchAttributes(null, requestOptions, opContext);
}
static void opContext_RequestCompleted(object sender, RequestEventArgs e)
{
var headers = e.Response.Headers;//e.Response.Headers will have all response headers
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.