禁用下载链接 [英] Disable Download Link

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

问题描述



问候!!

是否有任何解决方案可以禁用下载链接(仅在2小时内自动生成并启用).
因此,公共用户无法下载我的上传文件.

非常感谢您与我讨论.
谢谢!

Hi,

Greetings!!

Are there any solution to disable an download link ( auto generate and enable only in 2 hours).
So public users can not download my upload file.

It''s very kind of you for discussing with me.
Thanks !

推荐答案

一种方法是:

1.为要下载的文件创建链接.
2.获取服务器的当前时间戳,对其进行加密,然后将其放入下载链接的querystring .
3.每当有人访问时,解密qurystring 并检查当前时间.
4.如果经过的时间少于2小时,请让他查看页面.
5.如果没有将他推到错误页面.
One way to do this could be:

1. have the link created for the file to be downloaded.
2. Get the current time-stamp of server encrypt it and put it in the querystring of download link.
3. whenever someone visit decrypt the qurystring and check with current time.
4. if time elapsed is less then 2 hours let him see the page.
5. if not push him to error page.


1) You can add following tag in head of aspx page where (content="5") 5 is second of the interval for refreshing the page.
    <meta http-equiv="refresh" content="5">
   so in your case (2*3600) makes 2 hours refresh.
2) If you are adding download link dynamically so on each refresh toggle by viewstate variable and do remove/add of the hyperlink(<a> </a>) part so downloads gets restricted/allowed.


这篇关于禁用下载链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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