Azure Blob Storage – SDK, Properties and Metadata · AZ-204: Developing Solutions for Microsoft Azure Develop for Azure Storage

An ASP.NET Core application uploads a JPEG to Azure Blob Storage. The application must ensure that browsers and download clients recognize the blob a…

Practice question from Azure Blob Storage – SDK, Properties and Metadata (AZ-204: Developing Solutions for Microsoft Azure Develop for Azure Storage), with the correct answer and a step-by-step solution.

easy · MCQ · Q-8F69C3

An ASP.NET Core application uploads a JPEG to Azure Blob Storage. The application must ensure that browsers and download clients recognize the blob as an image. Which configuration should be used during upload?

  1. A.new BlobUploadOptions { HttpHeaders = new BlobHttpHeaders { ContentType = "image/jpeg" } }Correct answer
  2. B.new BlobUploadOptions { Metadata = new Dictionary<string, string> { ["ContentType"] = "image/jpeg" } }
  3. C.new BlobUploadOptions { Tags = new Dictionary<string, string> { ["ContentType"] = "image/jpeg" } }
  4. D.new BlobUploadOptions { Conditions = new BlobRequestConditions { IfNoneMatch = ETag.All } }

Solution

The ContentType value is an HTTP property, so it belongs in BlobHttpHeaders. Metadata and blob index tags are custom key-value collections and do not set the blob's HTTP content type.

More from Azure Blob Storage – SDK, Properties and Metadata

All of Azure Blob Storage – SDK, Properties and Metadata

Practise more Develop for Azure Storage

Sign up free for adaptive practice on this chapter, with instant feedback and hints on every question.

Start practising free

Free to start · No credit card needed