Share via


BlobRequestOptions.UseTransactionalMD5 Property

Definition

Gets or sets a value to calculate and send/validate content MD5 for transactions.

public bool? UseTransactionalMD5 { get; set; }
member this.UseTransactionalMD5 : Nullable<bool> with get, set
Public Property UseTransactionalMD5 As Nullable(Of Boolean)

Property Value

Use true to calculate and send/validate content MD5 for transactions; otherwise, false. Default is false.

Examples

MemoryStream targetStream;

// Instruct the Storage Client to request and validate the Content-MD5 for individual REST operations.
BlobRequestOptions optionsWithUseTransactionalMD5 = new BlobRequestOptions() { UseTransactionalMD5 = true };

using (targetStream = new MemoryStream())
{
    testBlob.DownloadToStream(targetStream, accessCondition: null, options: optionsWithUseTransactionalMD5);
}

Remarks

The UseTransactionalMD5 option instructs the Storage Client to calculate and validate the MD5 hash of individual Storage REST operations. For a given REST operation, if this value is set, both the Storage Client and the Storage service will calculate the MD5 hash of the transferred data, and will fail if the values do not match. This value is not persisted on the service or the client. This option applies to both upload and download operations. Note that HTTPS does a similar check during transit. If you are using HTTPS, we recommend this feature be off.

Applies to