I am using System.IO.Directory.GetCurrentDirectory() to get the current directory in my web service, but that does not give me the current directory. How do I get the current directory in a web service?
Thanks Stuart
To determine the exact location of your current directory within the file system, go to a shell prompt and type the command pwd. This tells you that you are in the user sam's directory, which is in the /home directory. The command pwd stands for print working directory.
The current directory is the current working directory, and is first in the search order when working with REXX File System (RFS). The current directory can be set using the CD command, CD. The CD command has a similar format to the cd command in operating systems such as DOS.
The pwd command displays the full, absolute path of the current, or working, directory.
In a webservice, you are running in a http context. So,
HttpContext.Current.Server.MapPath("~/")
will give you the answer.
You can use
AppDomain.CurrentDomain.BaseDirectory;
This gives you the root directory of your application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With