Hi Guys, I don't think ur method is workable. How do u guys know the exact number of users who is downloading the file? How do u know the completion of downloading? What happen if the user cancel downloading and close the browser? The session_end will never fired.Use application and session variable can only knows the total number of downloads, but not the number of concurrent downloading users in real time. Pls refer to my another post at http://expert.csdn.net/Expert/topic/2269/2269253.xml?temp=.1252558In that thread, I use my method for a secure download, but I think it is simple to modify my code in order to serve your purpose.
To gj0001(阿江),Page_Load does not means a real downloading started. My another question is how do u know the completion of downloading? When to "-1" from application["DownloadingUsers"]?
其他的办法我也不清楚,共同学习!
1、下载文件编号
2、下载文件路径
3、下载文件名称
.
.
.用户页面设计:
下载链接,链向文件下载页面,并传递参数,
如,<a href='<%# String.Format("filedownload.aspx?ID={0}",DataBinder.Eval(Container.DataItem,"下载文件编号"))%>' target="_blank">下载文件名</a>下载页面(filedownload.aspx)设计:
该页面中,用户页面传递来的参数(下载文件编号)在数据库中对应下载文件的路径,利用application和session对象,来限制下载用户,并同时关闭此页。祝成功!!!
Session["EnableDownload"]来控制权限
How do u know the completion of downloading?
What happen if the user cancel downloading and close the browser? The session_end will never fired.Use application and session variable can only knows the total number of downloads, but not the number of concurrent downloading users in real time.
Pls refer to my another post at http://expert.csdn.net/Expert/topic/2269/2269253.xml?temp=.1252558In that thread, I use my method for a secure download, but I think it is simple to modify my code in order to serve your purpose.
application["DownloadingUsers"]加1
当application["DownloadingUsers"]=10时,拒绝该页面
you are right!