我正在尝试获取应用程序的根文件夹。我已经使用了下面的代码,但是这给出了bin
文件夹,但我需要的是应用程序的根文件夹。是否有可能得到这个?如何获取ASP.NET应用程序的根文件夹
// This is the full directory and exe name
String fullAppName = Assembly.GetExecutingAssembly().GetName().CodeBase;
// This strips off the exe name
String fullAppPath = Path.GetDirectoryName(fullAppName);
我假设你正在调试,所以'bin'文件夹是应用程序的运行目录。你想要解决方案文件的位置吗? – PostMan 2011-05-06 07:53:02
你的意思是'bin \ Debug'或'bin \ Release'而不是'bin'? – 2011-05-06 07:54:32
我想要解决方案文件的位置,因为我需要添加一个文件夹到这个位置来保存上传文件 – user517406 2011-05-06 08:11:21