The question is not clear. In an ASP.NET code-behind code, you should of course use
MapPath
. For your separate application you execute on the server, this function does not mean anything certain. You can find the path where the currently running application is located this way:
string exeDir = System.IO.Path.GetDirectoryName(
System.Reflection.Assembly.GetEntryAssembly().Location;
By the way, there are many other ways to find this path, but some of them are not universal, they work incorrectly for some ways of hosting the application, etc. The method I show is universally correct.
—SA