Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have generated .DAT file and stored it in Server temp folder. Now When user clicks on Download button, the file is to be downloaded into their system. Before downloading a file, I want the browser to ask for a location in client's system like the way it happens when user downloads file in another browser.
What is the best practices to do it??

What I have tried:

checked in URL asp.net - How to download Server files into client system using c# - Stack Overflow[^].
Used WebClient but was not able to ask for a location in client's system
Posted
Updated 7-Dec-16 23:02pm

1 solution

You can't - it depends on the browser. Chrome for example always stores files in it's "downloads" folder, while some versions of IE brought up a "save" dialog by default (though this could be overridden).

You - as the server - have no control over what the client browser does with a file - you just serve it to the client and let it get on with it. (And TBH, if your website started making me specify where I wanted files, I wouldn't be a happy bunny).
 
Share this answer
 
Comments
Codes DeCodes 8-Dec-16 7:21am    
Got the point. Though I was using <updatepanel> and using response to export. I removed <updatepanel> and it worked the way I wanted...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900