C# .NET - System.AppDomain.CurrentDomain.BaseDirectory; how to change this path programatically

Asked By karur krishna madhu on 25-Nov-12 11:25 PM
System.AppDomain.CurrentDomain.BaseDirectory; how to change this path programatically

i have a file and its getting downloaded to bin \debug folder but i want that in someother folder.

string remoteUri = "http://www.contoso.com/library/homepage/images/";
            string fileName = "ms-banner.gif", myStringWebResource = null;


            // Create a new WebClient instance.
            WebClient myWebClient = new WebClient();
          


            // Concatenate the domain with the Web resource filename.
            myStringWebResource = remoteUri + fileName;

            Console.WriteLine("Downloading File \"{0}\" from \"{1}\" .......\n\n", fileName, myStringWebResource);


            // Download the Web resource and save it into the current filesystem folder.
            myWebClient.DownloadFile(myStringWebResource, fileName);


            //Getting the Base directory of the application.
            string strLocation = System.AppDomain.CurrentDomain.BaseDirectory;
            Console.WriteLine(strLocation);                      
                           
            Console.WriteLine("Successfully Downloaded File \"{0}\" from \"{1}\"", fileName, myStringWebResource);
            Console.WriteLine("\nDownloaded file saved in the following file system folder:\n\t" + ConfigurationManager.AppSettings["FlatfileInboundpath"].ToString());
            
Robbe Morris replied to karur krishna madhu on 25-Nov-12 11:33 PM
Put the full path in the fileName variable.  If you only put a file name, it will go in the folder your application executes in.
karur krishna madhu replied to Robbe Morris on 25-Nov-12 11:38 PM
Thanks morris it worked. thanks alot