I have an ASP.NET site where I load some validation rules from an xml file. This xml file name, with no path information, is hard-coded in the library. (I know that a hard-coded name is not very good, but let's just talk about it in this example).
When I launch the website, ASP.NET tries to find the XML file in the source path, where is the C # file in which the name is hardcoded. This is completely embarrassing to me, because I cannot understand how, at run time, we even consider the source path as an opportunity to resolve an unqualified file name.
public static string ValidationRulesFile {
get { return m_validationRulesFile; }
} private static string m_validationRulesFile = "validation_rules.xml";
m_validationRules.LoadRulesFromXml( Config.ValidationRulesFile, "Call" );
Here's an exception showing the path we are looking for is the same as Config.cs:
Exception Details: System.IO.FileNotFoundException:
Could not find file 'C:\temp\Project.Core\validation_rules.xml'.
- ? , ASP.NET, , , . , , .
UPDATE
LoadRulesFromXml
public void LoadRulesFromXml( string in_xmlFileName, string in_type )
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load( in_xmlFileName );
...
UPDATE2
, - Cassini , VS, . , VS , , , , , . .