如何计算下载次数. [英] How to count the number of download.
本文介绍了如何计算下载次数.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
假设我有一个文件显示在网页上作为链接.当我下载该文件时,它将显示为
Hi all,
Suppose i have a file which is display in the webpage as a link.When i download that file it will show the count as
Download:1
次.每次下载都会持续增加.
如何实现.请帮忙吗?
谢谢
times.It will go on increasing with every download.
How to achieve it.Please help?
Thanks
推荐答案
使用以下代码:希望它可以帮助您解决问题..
Hi,
use following code: hope it will help you n solve your problem..
protected void Page_Load(object sender, EventArgs e)
{
int id;
if (Int32.TryParse(Request.QueryString["file"], out id))
{
Count(id); // increment the counter
GetFile(id); // go to db or xml file to determine which file return to user
}
}
Google?
ASP.Net计数下载点击次数 [在ASP.NET中下载文件并跟踪下载成功/失败状态 [ ^ ]
Google?
ASP.Net Count Download Clicks[^]
Also check CP article File Download in ASP.NET and Tracking the Status of Success/Failure of Download[^]
可靠地执行此操作的唯一方法是将计数保存在数据库中,并在页面加载时检索值.
The only way to do this reliably is to save the count in a database, and retrieve the value whenever the page is loaded.
这篇关于如何计算下载次数.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文