1

In my application I am using Azure Blob Storage to store PDF and word files and container has public access.

Now in application there will be a list of name of all documents. and one link will be there 'View Document'. When user will click it that document should be displayed in dialog. But that document should not get download in any case. As document type only PDF and word file will be there.

Help me how to display it in dialog.

iDipa
  • 347
  • 2
  • 9
  • 20
  • There will be a list of name of all documents. and one link will be there 'View Document'. When user will click it that document should be displayed in dialog. – iDipa Mar 22 '16 at 12:26
  • Try to show it in dialog>iframe. – Vixed Mar 22 '16 at 12:27
  • dialog>iframe is downloading document only, not displaying. – iDipa Mar 22 '16 at 12:30
  • I think you have some confusion... A client can't display something without downloading it, i.e. the browser will need to get the bytes of the files over the network. Or do you mean that currently your user is presented with a download dialog box asking to open or save? – SvenAelterman Mar 23 '16 at 12:54

1 Answers1

0

Did you already set the content-type property of your blobs? For PDF, it should be "application/pdf".

https://msdn.microsoft.com/en-us/library/azure/ee691966.aspx

*x-ms-blob-content-type

Optional. Sets the blob’s content type. If this property is not specified on the request, then the property will be cleared for the blob. Subsequent calls to Get Blob Properties will not return this property, unless it is explicitly set on the blob again.*

Haibo Song
  • 71
  • 1
  • I just want to display document in dialog. Then how blob's content type matters? – iDipa Mar 23 '16 at 05:39
  • If the HTTP response has the content-type 'application/octet-stream' and no content-disposition, it seems the browser will automatically try to download it. You can refer to http://stackoverflow.com/questions/20508788/do-i-need-content-type-application-octet-stream-for-file-download to see how content-type and content-disposition headers work. – Haibo Song Mar 24 '16 at 01:27