Downloading File

Discussion in 'ASP .Net' started by - Steve -, Oct 15, 2004.

  1. - Steve -

    - Steve - Guest

    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.
    - Steve -, Oct 15, 2004
    #1
    1. Advertising

  2. - Steve -

    bruce barker Guest

    prpbably timing out. extend the response timeout.

    -- bruce (sqlwork.com)


    "- Steve -" <> wrote in message
    news:%...
    > 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.
    >
    >
    bruce barker, Oct 15, 2004
    #2
    1. Advertising

  3. - Steve -

    - Steve - Guest

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


    "bruce barker" <> wrote in message
    news:...
    > prpbably timing out. extend the response timeout.
    >
    > -- bruce (sqlwork.com)
    >
    >
    > "- Steve -" <> wrote in message
    > news:%...
    >> 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.
    >>
    >>

    >
    >
    - Steve -, Oct 15, 2004
    #3
  4. - Steve -

    - Steve - Guest

    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 -" <> wrote in message
    news:...
    >I have <httpRuntime executionTimeout="1800" /> in my Web.Config becuase
    >this part of the site is for uploading files also.
    >
    >
    > "bruce barker" <> wrote in message
    > news:...
    >> prpbably timing out. extend the response timeout.
    >>
    >> -- bruce (sqlwork.com)
    >>
    >>
    >> "- Steve -" <> wrote in message
    >> news:%...
    >>> 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.
    >>>
    >>>

    >>
    >>

    >
    >
    - Steve -, Oct 15, 2004
    #4
  5. - Steve -

    Joerg Jooss Guest

    - Steve - wrote:
    > 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,

    --
    Joerg Jooss
    www.joergjooss.de
    Joerg Jooss, Oct 16, 2004
    #5
  6. - Steve -

    - Steve - Guest

    Turned out to be a bug in the checkpoint firewall.


    "Joerg Jooss" <> wrote in message
    news:...
    >- Steve - wrote:
    >> 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,
    >
    > --
    > Joerg Jooss
    > www.joergjooss.de
    >
    >
    - Steve -, Oct 19, 2004
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ian Gordon

    Downloading a file...

    Ian Gordon, Jul 30, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    931
    Ian Gordon
    Jul 30, 2003
  2. Chris Morrison

    Downloading a file from a website

    Chris Morrison, Dec 18, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    491
    Vijayakrishna Pondala
    Dec 31, 2003
  3. Replies:
    0
    Views:
    394
  4. Steven

    Downloading a file

    Steven, Jul 28, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    376
    Joerg Jooss
    Aug 2, 2003
  5. Ian Gordon

    Downloading a file to client

    Ian Gordon, Jul 30, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    339
    Bill Priess
    Jul 30, 2003
Loading...

Share This Page