My web application have a download button and when the client click it, it must show a message saying that file was already downloaded.
Here is the code to download:
FileInfo arquivo = new FileInfo(pathCompletoArquivo);
FileInfo fInfo = arquivo;
Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=\"" + fInfo.Name + "\"");
Response.AddHeader("Content-Length", fInfo.Length.ToString());
Response.WriteFile(fInfo.FullName);
Response.Flush();
I want to show a message to the client after this, I tried popups, javascripts… but nothing would work.
Obs.: Dont need to show the message when the download is concluded.
You cannot do this on the same HTTP response that also sends the file contents back.
What you need to do is add a
clickhandler on the download button that displays a popup if the file has been downloaded, and makes the actual request to download the file (that runs the code you show us) if it has not. You would do that using JavaScript.