I use an HttpHandler on my podcast site to catch the requests for MP3's and increment a download counter. This seems to work pretty well, and I haven't had any problems to date. It also helps force the "save as" dialog so people aren't viewing them in their
browsers.
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()
{
}
Member
10 Points
291 Posts
The internals of using an HttpHandler and serving files
Nov 01, 2005 05:36 PM|Jeff|LINK
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();
}
}
POP Forums for MVC
JeffPutz.com