Downloading File

S

- Steve -

Is there a problem with this code?

string filePath = @"\\filer\backup$\filex\" + myFileID;

Response.Clear();

Response.ContentType = (string)myDataReader["ContentType"];

Response.AddHeader("Content-Disposition",

"attachment; filename=\"" + (string)myDataReader["FileName"] + "\"");

Response.AddHeader(

"Content-Length", (string)myDataReader["FileSize"]);

Response.Flush();

Response.WriteFile(filePath);



With a certain file it stops at 35% or 4.5mb of ~13mb of the file. I can't
figure out what I'm doing wrong espcically since it almost always works.
 
S

- Steve -

I have <httpRuntime executionTimeout="1800" /> in my Web.Config becuase this
part of the site is for uploading files also.


bruce barker said:
prpbably timing out. extend the response timeout.

-- bruce (sqlwork.com)


- Steve - said:
Is there a problem with this code?

string filePath = @"\\filer\backup$\filex\" + myFileID;

Response.Clear();

Response.ContentType = (string)myDataReader["ContentType"];

Response.AddHeader("Content-Disposition",

"attachment; filename=\"" + (string)myDataReader["FileName"] + "\"");

Response.AddHeader(

"Content-Length", (string)myDataReader["FileSize"]);

Response.Flush();

Response.WriteFile(filePath);



With a certain file it stops at 35% or 4.5mb of ~13mb of the file. I can't
figure out what I'm doing wrong espcically since it almost always works.
 
S

- Steve -

Another interesting tidbit. It stalls at different points on different
machines.

On one machine it stalls at 35% (in IE and FireFox), on another machine 94%.


- Steve - said:
I have <httpRuntime executionTimeout="1800" /> in my Web.Config becuase
this part of the site is for uploading files also.


bruce barker said:
prpbably timing out. extend the response timeout.

-- bruce (sqlwork.com)


- Steve - said:
Is there a problem with this code?

string filePath = @"\\filer\backup$\filex\" + myFileID;

Response.Clear();

Response.ContentType = (string)myDataReader["ContentType"];

Response.AddHeader("Content-Disposition",

"attachment; filename=\"" + (string)myDataReader["FileName"] + "\"");

Response.AddHeader(

"Content-Length", (string)myDataReader["FileSize"]);

Response.Flush();

Response.WriteFile(filePath);



With a certain file it stops at 35% or 4.5mb of ~13mb of the file. I can't
figure out what I'm doing wrong espcically since it almost always works.
 
J

Joerg Jooss

- Steve - said:
Is there a problem with this code?

string filePath = @"\\filer\backup$\filex\" + myFileID;

Response.Clear();

Response.ContentType = (string)myDataReader["ContentType"];

Response.AddHeader("Content-Disposition",

"attachment; filename=\"" + (string)myDataReader["FileName"] + "\"");

Response.AddHeader(

"Content-Length", (string)myDataReader["FileSize"]);

Response.Flush();

Response.WriteFile(filePath);



With a certain file it stops at 35% or 4.5mb of ~13mb of the file. I
can't figure out what I'm doing wrong espcically since it almost
always works.

Could it be that the "FileSize" from the database is wrong?

Cheers,
 
S

- Steve -

Turned out to be a bug in the checkpoint firewall.


Joerg Jooss said:
- Steve - said:
Is there a problem with this code?

string filePath = @"\\filer\backup$\filex\" + myFileID;

Response.Clear();

Response.ContentType = (string)myDataReader["ContentType"];

Response.AddHeader("Content-Disposition",

"attachment; filename=\"" + (string)myDataReader["FileName"] + "\"");

Response.AddHeader(

"Content-Length", (string)myDataReader["FileSize"]);

Response.Flush();

Response.WriteFile(filePath);



With a certain file it stops at 35% or 4.5mb of ~13mb of the file. I
can't figure out what I'm doing wrong espcically since it almost
always works.

Could it be that the "FileSize" from the database is wrong?

Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top