0

i want to save the pdf file into client machine where programs file is there.But it shouldn't ask the user,where it would save.That means the file would save where the user should install the application,in that folder the the pdf file should save in windows application at c#.

Divakar
  • 31
  • 2
  • 6
  • 1
    Not sure there's a question here? What have you already done, what is your expected outcome, and what errors have you gotten so far? – alybaba726 May 14 '15 at 15:08
  • 1
    For console/forms see http://stackoverflow.com/questions/837488/how-can-i-get-the-applications-path-in-a-net-console-application - You may consider a more appropriate storage location such as AppData – Alex K. May 14 '15 at 15:08
  • It is likely that the user will not be able to save into the directory if a standard 'Program Files' installation is followed. Seconding Alex K's comment on using AppData folder instead. – Steve Mitcham May 14 '15 at 15:11

2 Answers2

3

On Windows 7 and later ... access to the Program Files/(x86) folders are restricted and require admin rights. If the application does have the required permissions to save to that folder, Application.ExecutablePath will provide you with the location that the executable is running in. You can use various methods in the System.IO.Path namespace to retrieve the folder name out of it.

Marc Johnston
  • 1,276
  • 1
  • 7
  • 16
2

Use AppDomain.CurrentDomain.BaseDirectory + "\\your-files-name.ext"

Jeremy Barnes
  • 657
  • 4
  • 15