HttpHandlers and big files
However, when I try to apply the same concept to big video files, it chokes. iTunes says the network connection is reset while Firefox simply says the document contains no data.
What might be going on here? The code is what you've likely seen in countless examples elsewhere, like this:
public class MovHandler : IHttpHandler
{
public MovHandler()
{
}
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
context.Response.Clear();
context.Response.ContentType = "video/quicktime";
string path = context.Server.MapPath(context.Request.FilePath);
NewsItem item = new NewsItem(Path.GetFileName(context.Request.FilePath));
item.Downloads++;
item.Update();
context.Response.WriteFile(path);
context.Response.End();
}
}