Hi,
Make an aspx file where you have a download link(it can be an anchor
tag or a server control.
If you use a server control such as LinkButton use this code when it is
clicked :
create a table for the downloads for eg : with date and no_of_downloads
and call it download_tracker.
System.IO.FileInfo file = new System.IO.FileInfo(filepath);
if(file.Exists)
{
Response.Clear();
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition","attachment;filename=" +
file.Name);
update the no_of_downloads in download tracker table for the
corresponding day.
Response.WriteFile(file.FullName);
Response.Flush();
Response.End();
}
if you use another aspx page to do the same put it in Page_Load event of
that page..
when you click an anchor tag(client side)
It is little tricky : you need to send some client side script from that
aspx page to close that page.
Hope this helps ;
Regards,
Marshal Antony
http://www.dotnetmarshal.com