如何从dll中找到网站的根路径?

Bif*_*iff 3 c# dll web-applications path

我有一个C#网站.它引用了几个已编译的dll.我的dll需要访问网站上的文件夹.如何从dll中找到网站的根路径?

我试过了

System.Environment.CurrentDirectory - >"C:\ Program Files\Microsoft Visual Studio 9.0\Common7\IDE"

Assembly.GetExecutingAssembly().Location - > C:\ WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files ......

我打算用

System.Web.HttpContext.Current.Server.MapPath()

但System.Web.HttpContext.Current为null.

谢谢!

SLa*_*aks 8

您正在寻找HttpRuntime.AppDomainAppPath可以在ASP.Net AppDomain中的任何位置使用的属性.