能不能写出这样一个class: 其编译为dll后若被一个web程式引用,那么它可以获得这个web程式所在的根虚拟目

>>>这个web程式所在的根虚拟目录的名称及其绝对路径

try

public class YourClass
{
public string 虚拟目录的名称
{
get { return System.Web.HttpContext.Current.Request.ApplicationPath;}
}

public string 虚拟目录绝对路径
{
get { return System.Web.HttpContext.Current.Request.PhysicalApplicationPath;}
}

}

Published At
Categories with Web编程
Tagged with
comments powered by Disqus