A
Alon Albert
I have an ASP.NET that has an aspx that serves a binary file for download. I
need this rather than a direct link for various reasons.
I am getting the following error intermitently:
The server committed a protocol violation. Section=ResponseStatusLine
I tried adding:
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing="true" />
</settings>
</system.net> to the web.config file but made no difference.
I am using .NET 2.0.
The download client is also a .NET application.
The code that serves the file looks like this:
private void Page_Load(object sender, System.EventArgs e) {
string filename = Request["filename"];
string path = string.Format("c:/files/{0}", filename);
Response.ContentType = "APPLICATION/octet-stream";
Response.AddHeader("Content-Disposition",
string.Format("attachment;filename={0}", filename));
FileInfo fi = new FileInfo(path);
Response.AddHeader("Content-Length", fi.Length.ToString());
Response.Flush();
Response.TransmitFile(path);
Response.End();
}
The client code reads from
WebRequest.Create(url).GetResponse().GetResponseStream().
Any ideas? I have run out of my own.
need this rather than a direct link for various reasons.
I am getting the following error intermitently:
The server committed a protocol violation. Section=ResponseStatusLine
I tried adding:
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing="true" />
</settings>
</system.net> to the web.config file but made no difference.
I am using .NET 2.0.
The download client is also a .NET application.
The code that serves the file looks like this:
private void Page_Load(object sender, System.EventArgs e) {
string filename = Request["filename"];
string path = string.Format("c:/files/{0}", filename);
Response.ContentType = "APPLICATION/octet-stream";
Response.AddHeader("Content-Disposition",
string.Format("attachment;filename={0}", filename));
FileInfo fi = new FileInfo(path);
Response.AddHeader("Content-Length", fi.Length.ToString());
Response.Flush();
Response.TransmitFile(path);
Response.End();
}
The client code reads from
WebRequest.Create(url).GetResponse().GetResponseStream().
Any ideas? I have run out of my own.