+ -
当前位置:首页 → 问答吧 → ashx 里面取当年文件的决定路径

ashx 里面取当年文件的决定路径

时间:2011-12-16

来源:互联网

xxx.cs里面
我一般就Server.MapPath("/ ")

但是ashx里面发现没有sevser这个对象
该怎么取当前文件下得绝对路径了??

作者: slxliuxingbing   发布时间: 2011-12-16

用这个试试:System.Web.HttpContext.Current.Server.MapPath("");
另外这个表示根目录:AppDomain.CurrentDomain.BaseDirectory

作者: dalmeeme   发布时间: 2011-12-16

C# code
用AppDomain.CurrentDomain.BaseDirectory+"路径"

作者: zhangzhen900530   发布时间: 2011-12-16

用 HttpContext 對象
C# code

public void ProcessRequest(HttpContext context)
{
context.Server.MapPath("/ ");
}

作者: zhangbin1988   发布时间: 2011-12-16