Blob存储和过期的链接 [英] Blob storage and expired links

查看:75
本文介绍了Blob存储和过期的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我有一个Blob存储区,并向用户提供下载链接.如果链接过期,则服务将获取一个XML文件供下载.

Hi, I have a blob storage and provide download links to the user. If a link expired, the ser get a xml file for download. 

XML:

<Error>
<Code>AuthenticationFailed</Code>
<Message>
Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:df3b-e01e-0a5-4a3d-0d000000 Time:2018-11-10T21:36:20.0951989Z
</Message>
<AuthenticationErrorDetail>
Signature not valid in the specified time frame: Start [Fri, 09 Nov 2018 09:34:46 GMT] - Expiry [Sat, 10 Nov 2018 09:34:46 GMT] - Current [Sat, 10 Nov 2018 21:36:20 GMT]
</AuthenticationErrorDetail>
</Error>

这是正确的,但是我如何说"呢?是否将出现此错误消息的html服务器发送到用户浏览器,而不是xml文件下载?

This is correct, but how I can "say" azure to server html to the user browser with this error message, instead xml file for download?

谢谢!

阿迪

推荐答案

为了在浏览器中打开文件而不是下载文件,您需要设置Blob的content-type属性.对于XML,您应该能够将内容类型设置为"application/xml".

In order to open the file in the browser instead of downloading it, you will need to set the content-type property of the blob. For XML, you should be able to set the content-type to "application/xml".

通过使用Azure Storage REST API,可以使用Set Blob Properties操作并在请求标头中指定content-type来执行此操作,如以下指南所述:  https://docs.microsoft.com/zh-CN/rest/api /storageservices/set-blob-properties#request-headers-all-blob-types

By using the Azure Storage REST API, you can use the Set Blob Properties operation and specify the content-type in the request header to do this as mentioned in the following guide: https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-properties#request-headers-all-blob-types

如果此答案有帮助,请单击标记为答案"或向上投票.要提供有关您的论坛体验的其他反馈,请单击 此处

If this answer was helpful, click "Mark as Answer" or Up-Vote. To provide additional feedback on your forum experience, click Here


这篇关于Blob存储和过期的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆