In my asp.net application, I have a util class that will read some data from an XML file, after which I can call this class later, the file needs to be loaded once, so I use a static constructor.
class UtilHelper{
static UtilHelper(){
XmlDocument doc=new XmlDocument();
doc.load("a.xml");
}
}
Some people may suggest that I am using "Server.mappath (xxx)"
But this class is not xx.aspx.cs. Thus, in the context there is no "HttpRequest" or "HttpServerUtilly".
Any ideas?
source
share