Downloading file using webclient with a save dialogue box
-
24-05-2021 - |
Pergunta
I have one doubt, in my website i have to give an option for the front end users to download an exe from my website with a progress bar.
So can i use webClient.DownloadFile()?
But when i use
webClient.DownloadFileAsync(new Uri("http://xyztest.com/xyztest.exe"), "xyztest.exe");
then the exe is saving to my website's folder path.
I want to save the file with a save dialogue box and with a progress bar. Please give your suggestions.
Thanks,
Mahesh
Solução
You need to set the Content-Disposition: Attachment;
of the xyztest.exe.
Then just specify the url in the browser after the user accepts and it will download automatically.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow