Hi,
I have a collection of files which are constantly being created on a remote server, but not uploaded to my web server until requested by a client. When a client requests a file, I want to pull it onto my web werver, whilst checking for it's creation using a FileSystemWatcher. Once it is created, I wish to initiate a download by doing:
Response.Clear();
Response.ContentType = "text/plain";
Response.AddHeader("content-disposition", "attachment; filename=" + channelAFileInfo.Name);
Response.AddHeader("content-length", channelAFileInfo.Length.ToString());
Response.WriteFile(channelAFileInfo.FullName);
Response.End();
The problem is that I want checking for the file to continue in the background, event if a user navigates off the page after requesting a file. Since Page.HttpResponse is only available in code-behind, how can I do this?
I have tried using a separate class, created in the session state, and passing this.Response into it from the initial page so that I have a reference to it, but of course this is invalid too. My other idea is to open up a popup window or a hidden window to handle the http response. I think this option would work, but it seems messy to me.
If all else fails, I could just say: "stay on the page until the download completes" but I would prefer not to.
I would appreciate any help with this, as I am pretty confused as to what to do. I can't find any documentation of similar problems.
Many Thanks,
kreid