You can add additional logic such as download count or access restriction.
First things first, you'll need to setup your HttpHandler, I've called mine GetFile.cs:
namespace Sample.HttpHandlers
{
public class GetFile : IHttpHandler
{
public bool IsReusable
{
get { return false; }
}
public void ProcessRequest(HttpContext context)
{
// The logic goes here
}
}
}
Remember to add the handler in your web.config, additional information can be found at microsoft support.<add name="GetFile" verb="*" path="GetFile.axd" type="Sample.HttpHandlers.GetFile"/>