Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to open save as dialog box in asp.net
Posted

I did a search and found some resources on the internet.
ASP.NET/C# Prompt a Save Dialog Box to Download a File[^] should be useful to you.
This[^] is another good resource.
 
Share this answer
 
Comments
Shahin Khorshidnia 1-May-12 5:25am    
Good links +5
Abhinav S 1-May-12 5:43am    
Thank you.
If this really is ASP.NET, - i.e. a web site based program - then you can't, not in the way you mean. If you want to open a save as for the server file system, then you can open a OpenFileDialog, but it will appear on the Server, not the Client. If this is to do with downloading a file to the client and forcing a save dialog at his end, you can't do that either - the download is under the control of the browser and it and it alone decides if a save dialog is needed.
 
Share this answer
 
Comments
Shahin Khorshidnia 1-May-12 5:18am    
5
C#
String FileName = "FileName.txt";
String FilePath = "C:/...."; //Replace this
System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
response.ClearContent();
response.Clear();
response.ContentType = "text/plain";
response.AddHeader("Content-Disposition", "attachment; filename=" + FileName + ";");
response.TransmitFile(FilePath);
response.Flush();
response.End();
 
Share this answer
 
v2
Comments
Shahin Khorshidnia 1-May-12 5:24am    
+5 for the solution and -1 because you forgot to name the refrence: http://www.eggheadcafe.com/community/csharp/2/10429737/how-to-use-savefiledialog-in-c-web-application.aspx

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