开发者

C# ASP.NET File Serving Resume and Section

开发者 https://www.devze.com 2023-02-06 21:07 出处:网络
I have files to serve. When user click the file how to generate a random URL that valid only 15 minutes, 开发者_如何学Goand when download start, the file can support multiple section and support resum

I have files to serve. When user click the file how to generate a random URL that valid only 15 minutes, 开发者_如何学Goand when download start, the file can support multiple section and support resume. I thought there must be some mathematics involved, do you have any idea how this can be done?

Also for free user, I will make the link to not able for resume and only 1 section, how to do that?


You need to generate a GUID or somesuch and store it in a database/session with the time generated. You can then pass the GUID in the URL and validate the time started with the time now. >15 is invalid.

As to sections and resume, this is not a thing for your server, this is a client thing, all your server needs to do is support byte ranges through HTTP.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号