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> asp.net 跳转到登录页面问题 使用System.Net.Mail调用邮件服务器身份验证失败(用户名密码正确) 页面的字符串截取是怎么写的? 关于团队开发 请问HTML服务器控件和WEB控件的区别,及各自的用途?能混合用吗? 做欧美外包怎么样,会不会和日本外包一样,有相关经验的过来指点一下,多谢 为什么asp.net中的控件无法拖动????????? 请教一个SqlDataSource的问题 求教一下sql server 2000的问题(以前装上没问题的)!!! webapi 如何跨域设置和获取 cookie 写个函数,请教下思路 关于参数化查询疑问。。。。
{
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>