asp.net怎么统计软件的下载次数 这个要在js判断了 return false 不计算 return true 计算 (不知道对不对) 请告诉解答 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在button里加个aplication吗,或者在一个表中加个字段,每次点击了button时就更新字段啊 public class DownloadHandler : IHttpHandler{ public void ProcessRequest(HttpContext context) { string fileName = context.Request.QueryString["filename"].ToString(); string filePath = "path of the file on disk"; //you know where your files are FileInfo file = new System.IO.FileInfo(filePath); if (file.Exists) { try { //更新数据库中的下载次数 } catch (Exception) { //handl. } //return the file context.Response.Clear(); context.Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name); context.Response.AddHeader("Content-Length", file.Length.ToString()); context.Response.ContentType = "application/octet-stream"; context.Response.WriteFile(file.FullName); context.ApplicationInstance.CompleteRequest(); context.Response.End(); } } public bool IsReusable { get { return true; } }}Web.config<httpHandlers> <add verb="GET" path="FileDownload.ashx" type="DownloadHandler"/></httpHandlers> page<a href="FileDownload.ashx?filename=file.exe">Download file.exe</a> 求助 、如何初始绑定页面输出的select prototype.js ajax post方式无法获取text控件值 VS2008创建控件时出错,新建网站提示失败,这是什么原因 为什么图片会这样 为什么母板页的ContnentPlaceHolder不能移动的??? 大家好!我用iframe做了首页,可左右iframe总和上边的iframe之间有点空白 asp.net做数据库增加记录操作,报错说"Operation must be updateable query" 系统求救 .net配置文件问题 ASPNET怎样改变权限? 写个函数,请教下思路 关于参数化查询疑问。。。。
{
public void ProcessRequest(HttpContext context)
{
string fileName = context.Request.QueryString["filename"].ToString();
string filePath = "path of the file on disk"; //you know where your files are
FileInfo file = new System.IO.FileInfo(filePath);
if (file.Exists)
{
try
{
//更新数据库中的下载次数
}
catch (Exception)
{
//handl.
}
//return the file
context.Response.Clear();
context.Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
context.Response.AddHeader("Content-Length", file.Length.ToString());
context.Response.ContentType = "application/octet-stream";
context.Response.WriteFile(file.FullName);
context.ApplicationInstance.CompleteRequest();
context.Response.End();
}
}
public bool IsReusable
{
get { return true; }
}
}Web.config
<httpHandlers>
<add verb="GET" path="FileDownload.ashx" type="DownloadHandler"/>
</httpHandlers> page
<a href="FileDownload.ashx?filename=file.exe">Download file.exe</a>