【发布时间】:2009-01-22 02:23:13
【问题描述】:
我正在尝试获取网站根目录中文件夹的路径,并在调用控制器构造函数时将其保存到类属性中:
public TestController:Controller{
string temp;
public TestController(){
temp = "";
}
}
我尝试了以下方法:
temp = Server.MapPath("~/TheFolder/"); // Server is null - error.
temp = Request.PhysicalApplicationPath + @"TheFolder\"; // Request is null - error.
有什么想法吗?
【问题讨论】:
标签: .net asp.net-mvc