Last post Mar 20, 2006 01:40 PM by ghostofpc
Mar 19, 2006 04:02 PM|ghostofpc|LINK
I have a problem with Ihttphandler.
I want to create an Ihttphandler that controls user whether the user is one of the members of my web site when the user request a downloadble files such as .zip or .rar. I have written and given it below my codes dont work. When files are requested, Ihttphandler
checks user but it doesnt let the user download the file. Anyone solve the problem please?
public bool IsReusable
return false; }
public void ProcessRequest(HttpContext context)
string parts = context.Request.Url.Segments;
string last = parts[parts.Length - 1];
context.Response.WriteFile("files/" + last);
Mar 19, 2006 04:21 PM|kobipinhasov|LINK
context.Response.WriteFile(context.Server.MapPath("files/" + last));
Mar 20, 2006 01:40 PM|ghostofpc|LINK
thanks for reply Kobipinhasov
context.Response.ContentType = "audio/mpeg"
context.Response.WriteFile("/myhandler/files/" + last);
I solved the problem. It occurs because it writes the content of file to the output stream as html format but because this is a downloable file, the httphandler must write the content of file the output stream as zip or .mp3 whatever the file
Now, I can check the requests coming for my files not only aspx files.