Na miña aplicación asp.net, teño unha clase util que lerá algúns datos dun ficheiro XML, entón podo chamar a esta clase máis tarde, o ficheiro debería cargarse unha vez, polo que uso o construtor estático .
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.
}
}
Algunhas persoas poden suxerir que use "Server.mappath (xxx)"
Pero esta clase non é o xx.aspx.cs. Polo tanto, non hai "HttpRequest" nin "HttpServerUtilly" no contexto.
Algunha idea?