开发者

C# ASP.NET File Serving Resume and Section

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜