0

i'm wondering if there is a way to download a .txt file directly into the users application directory, i know i can download to pre defined locations e.g. desktop/app data folders etc, but a user will run the .exe from dynamic places (wherever they have the files running) so i can't hard code it in, so far it's basic:

    using (WebClient webClient = new WebClient())
    {
        webClient.DownloadFile("http://www.example.com/project.txt", DOWNLOAD_PATH_HERE_FROM_WHERE_THE_PROGRAM_EXECUTES);
    }

I couldn't see anything from googling but it's possible i have missed the answer.

Any help would be appreciated.

colinreedy674
  • 365
  • 2
  • 12
  • 1
    It depends a lot on the specific type of your application. Is it a Console app? Winforms? WPF? – Camilo Terevinto Jun 26 '17 at 19:11
  • Your question is quite unclear. Are you looking for the current directory? The location of your EXE file? Have you tried Googling either of those? – SLaks Jun 26 '17 at 19:17
  • it's a winforms app Camilo. the location of the .exe file ideally, so if someone runs it from: C:\folder\programname\start.exe it will download beside the start.exe for example :) – colinreedy674 Jun 26 '17 at 19:17
  • found it guys it: AppDomain.CurrentDomain.BaseDirectory – colinreedy674 Jun 26 '17 at 20:00

0 Answers0