Professional Web Applications Themes

Downloading files cause IE to lock up in ASPX page - ASP.NET General

I have the most peculiar problem with an ASP.NET page which we use for downloading a file. When the user clicks on a link, the link points to an ASPX page which downloads the file selected. The code works fine except after the user saves the file, the links on the left side of the frameset do not work. IE locks up. If the user clicks the refresh button after they download, then everything works properly again. Or if the user selects 'OPEN' instead of 'SAVE' on the download dialog box then the problem doesn't occur. If I comment out ...

  1. #1

    Default Downloading files cause IE to lock up in ASPX page

    I have the most peculiar problem with an ASP.NET page which we use for
    downloading a file.

    When the user clicks on a link, the link points to an ASPX page which
    downloads the file selected.

    The code works fine except after the user saves the file, the links on the
    left side of the
    frameset do not work. IE locks up.

    If the user clicks the refresh button after they download, then everything
    works properly again.
    Or if the user selects 'OPEN' instead of 'SAVE' on the download dialog box
    then the problem doesn't occur.

    If I comment out the following line then the problem doesn't occur, however
    the attachment name doesn't
    appear in the download dialog box either.

    Response.AddHeader("Content-Disposition", "attachment; filename=" +
    filename);

    There is something about the attachment name that is causing this problem.

    The reason we do this in an aspx page instead of in a script is because we
    want to do a server side
    database update to record the user who is about to download the file (that
    code is not shown below).

    private void Page_Load(object sender, System.EventArgs e)
    {
    FileInfo fi = new FileInfo("C:\\test.aspx");
    string filename = fi.Name;
    Response.Clear();
    Response.ClearHeaders();
    Response.ClearContent();
    // "\"" + filename + "\"\""
    Response.AddHeader("Content-Disposition", "attachment; filename=" +
    filename);
    Response.AppendHeader("Content-Length", fi.Length.ToString());
    Response.ContentType = "application/octet-stream";
    Response.WriteFile(filepath);
    Response.End();
    Response.Flush();
    }


    Tony Guest

  2. #2

    Default Re: Downloading files cause IE to lock up in ASPX page

    by using a register script similar to this in your code then you can
    actually use a script from your server.

    this.RegisterStartupScript("popupDialog", "<script language='javascript'>
    showAlertDialog(); </script>");

    simply place it after the code that you need to fire first.


    Karl



    "Tony K" <com> wrote in message
    news:phx.gbl... 
    however 


    karl Guest

  3. #3

    Default Re: Downloading files cause IE to lock up in ASPX page

    I can't say I totally understand how registering a script would help in this
    situation since I have server side database updates to do, to record history
    of downloads, etc.

    Maybe if you could expand on your example a little more so I would know
    where the database updates would go and how to execute the script on the
    server side that would help. If registering the script is an IE only
    solution then we can't use it since we are trying to support Netscape 6.0
    also.

    I'd also like to know if this is a known bug in ASP.NET or a bug in IE.
    Netscape doesn't have this problem.

    Here is all the code if that helps.

    private void Page_Load(object sender, System.EventArgs e)
    {
    UploadedFiles UPFiles = new UploadedFiles();
    string filepath = Page.Request.Params["file"];
    if (!(filepath == null))
    {
    HPSession HPSess = new HPSession();
    string UserID = HPSess.getUserIDbySessionID(Session.SessionID);
    UPFiles.UploadedFilesHistoryAddUpdate("",
    Page.Request.Params["UploadedFileID"], UserID);
    FileInfo fi = new FileInfo(filepath);
    string filename = fi.Name;
    Response.Clear();
    Response.ClearHeaders();
    Response.ClearContent();
    Response.AddHeader("Content-Disposition", "attachment; filename=" +
    filename);
    Response.AppendHeader("Content-Length", fi.Length.ToString());
    Response.ContentType = "application/octet-stream";
    Response.WriteFile(filepath);
    Response.End();
    Response.Flush();
    }
    }




    "karl" <com> wrote in message
    news:phx.gbl... [/ref]
    the [/ref]
    everything [/ref]
    box 
    > however [/ref]
    problem. [/ref]
    we [/ref]
    (that 
    >
    >[/ref]


    Tony Guest

  4. #4

    Default Re: Downloading files cause IE to lock up in ASPX page

    Hi Tony,

    Please take a look at the following URL:

    http://www.eggheadcafe.com/articles/20011006.asp

    If I have misunderstood your concern, please let me know.

    Best regards,

    Jacob Yang
    Microsoft Online Partner Support
    <MCSD>
    Get Secure! 每 www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.

    Jacob Guest

  5. #5

    Default Re: Downloading files cause IE to lock up in ASPX page

    I tried executing the code from the link you provided. The code never gets
    executed even when I click the "get PDF" button. I'm glad to know that
    there may be problems with downloading PDF files, and that there is a fix
    for it, but this is not the problem I am experiencing. The files download
    just fine (they are text files).

    However, after the user successfully downloads the files the hyperlinks in
    the frameset do not work until the user clicks the refresh button.


    "Jacob Yang [MSFT]" <microsoft.com> wrote in message
    news:phx.gbl... 


    Tony Guest

  6. #6

    Default Re: Downloading files cause IE to lock up in ASPX page

    Okay, I finally got the server-side script to work. However, the problem
    with IE breaking still remains.

    This was a fun exercise. I now know how to execute code from a server side
    script. The key was making sure not to reference the "code behind" in the
    language statement.

    In other words, do this:
    <% Page Language="C#" %>

    NOT this:

    <% Page language="c#" Codebehind="FileDownload.aspx.cs"
    AutoEventWireup="false" Inherits="HIPAAWeb.Upload.FileDownload" %>

    So, now that this exercise has been completed. We need to get back to the
    real problem. As stated in my first posting, this problem only occurs in IE
    not Netscape. After downloading and SAVING the downloaded file, IE will not
    load a page when you click on a hyperlink in the left side of a frameset.

    Send me a note and I will give you a private link to our test web servers
    where you can see the problem for yourself.

    Thanks,

    Tony Kurzendoerfer




    "Jacob Yang [MSFT]" <microsoft.com> wrote in message
    news:phx.gbl... 


    Tony Guest

  7. #7

    Default Re: Downloading files cause IE to lock up in ASPX page

    Hi Tony,

    I am very glad to know that the server-side script works now. Thank you for
    sharing the information.

    For the original question, please send the following to my email box
    com :

    1. The private link to show me the problem step by step

    2. The related server side code for the downloading

    I certainly appreciate your time.

    Best regards,

    Jacob Yang
    Microsoft Online Partner Support
    <MCSD>
    Get Secure! 每 www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.

    Jacob Guest

Similar Threads

  1. Cannot edit a page even after deleting lock files
    By JrHighTechie in forum Macromedia Contribute General Discussion
    Replies: 1
    Last Post: January 17th, 06:48 AM
  2. Cannot Lock aspx File
    By yost_w in forum Macromedia Contribute General Discussion
    Replies: 2
    Last Post: June 22nd, 08:00 PM
  3. Replies: 0
    Last Post: June 12th, 10:47 PM
  4. Controlling Page Access in .aspx page
    By Shawn Berg in forum ASP.NET Security
    Replies: 2
    Last Post: February 23rd, 01:56 PM
  5. Replies: 0
    Last Post: July 4th, 09:24 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139