why the UnloadConfirmer control starts to work while the window has not closed?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

why the UnloadConfirmer control starts to work while the window has not closed?

Guest-970
Hi Dean,

On the user control .ascx file, there are two parts: 1) Upload part: use MultiFiles component to upload multiple files to the destination folder. 2) Download part: it downloads a file from whatever directory to user's box. There is a button "Download" in this part .

What I do is this: Step 1: click "Pick Files", select mulitple files, click "Submit". The upload process works fine. Step 2: Now, I click the button "Download" (the event handler code is below), there is no problem to download the file. Step 3: click "Pick Files" again to upload more files. Problem occurs: Your UnloadConfirmer control pops up a message "Are you sure you want to navigate away from this page? Are you sure you want to cancel any upload that is in progress? Press OK to continue, or Cancel to stay on the current page.". I don't close the window, how come this message pops up?

Anyway, the event handler for the button Download has this code:

protected void Button_Download_Click(object sender, EventArgs e)
{
            this.Page.Response.Clear();
            this.Page.Response.ClearContent();
            this.Page.Response.ClearHeaders();

            this.Page.Response.ContentType = "application/octet-stream";
            this.Page.Response.AppendHeader("Content-Disposition", "attachment;  
                     filename=MyFile.txt");
            //MyFile.txt locates at the Target_Directory
            this.Page.Response.TransmitFile(Target_Directory + "MyFile.txt");
            this.Page.Response.End();
}

Do you know why the UnloadConfirmer control starts to work while the window has not closed? Thanks.

Stock
Reply | Threaded
Open this post in threaded view
|

Re: why the UnloadConfirmer control starts to work while the window has not closed?

Dean Brettle
Administrator
You should get a fresh page displayed when the upload completes.  Do you?  Can you email me (dean at brettle dot com) a small test app that shows the problem?  Also what version of NeatUpload and browser are you using?

Thanks,
--Dean
Reply | Threaded
Open this post in threaded view
|

Re: why the UnloadConfirmer control starts to work while the window has not closed?

Guest-970
Not clear about "get a fresh page displayed when the upload completes". Do you mean as soon as the upload process has finished, redirect the page to the same URL? By the way, I used your latest version of NeatUpload. Stock.
Reply | Threaded
Open this post in threaded view
|

Re: why the UnloadConfirmer control starts to work while the window has not closed?

Guest-970
The browser is IE 7.
Reply | Threaded
Open this post in threaded view
|

Re: why the UnloadConfirmer control starts to work while the window has not closed?

Dean Brettle
Administrator
By "fresh page displayed" I mean that the browser should receive a fresh copy of the page from the server and should display it.  You don't need to do a redirect for that.  To see if it is occuring, add <%= DateTime.Now %> to your aspx or ascx and see if the displayed time changes when the upload completes.  It should.

--Dean