将标题从blob复制到HttpContentHeader集合时,如下所示:
response.Content.Headers.ContentLength = blob.Properties.Length;
我想知道是否有办法从CloudBlobBlob获取所有原始标题,而不是像上面那样复制它们
答案 0 :(得分:0)
这对你有用吗?
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
}