【发布时间】:2011-08-06 09:14:31
【问题描述】:
在我的asp.net应用程序中,我有一个util类将从xml文件中读取一些数据,然后我可以稍后调用这个类,文件应该加载一次,所以我使用静态构造函数。
class UtilHelper{
static UtilHelper(){
XmlDocument doc=new XmlDocument();
doc.load("a.xml"); //here the asp.net cannot find the file,it always try to find file in the iis's dictionary.
}
}
有些人可能会建议我使用“Server.mappath(xxx)”
但是这个类不是xx.aspx.cs。所以上下文中没有“HttpRequest”或“HttpServerUtilly”。
有什么想法吗?
【问题讨论】:
标签: asp.net relative-path app-code