Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
how to open save as dialog box in asp.net
Posted 30-Apr-12 22:33pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Comments
Shahin Khorshidnia at 1-May-12 5:25am
   
Good links +5
Abhinav S at 1-May-12 5:43am
   
Thank you.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
Comments
Shahin Khorshidnia at 1-May-12 5:18am
   
5
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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();
  Permalink  
v2
Comments
Shahin Khorshidnia at 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)

  Print Answers RSS
0 BillWoodruff 314
1 Sergey Alexandrovich Kryukov 290
2 George Jonsson 274
3 CPallini 255
4 OriginalGriff 237
0 OriginalGriff 4,895
1 CPallini 4,010
2 Sergey Alexandrovich Kryukov 3,514
3 George Jonsson 2,826
4 Gihan Liyanage 2,386


Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 1 May 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100