M
Martin Eyles
Hi,
I have an xml config file for my website, which stores all the
information required to connect to a database. I have used the following
code to get the xml file into my program as an object, and this works
beautifully, as long as I directly call it from my codebehind.
Dim MyConfigXml As New System.Xml.XmlDataDocument
MyConfigXml.Load(aHttpServUtil.MapPath("My.config"))
However, as the settings are common I would like to use this in a static
method (sorry, just realised, I mean shared function - I learnt programing
in java mainly, so I sometimes mix up the terms) of an object, and call it
from all my pages. Unfortunately, when I do
this the MapPath gives compiler errors, and I have to manually enter the
entire path into the method. Are there any other ways of getting the path -
the path of the config file is the same as that of all of my .vb files. I am
using the VB.net language, .net framework 1.1 and VS.net 2003.
Thanks,
Martin
I have an xml config file for my website, which stores all the
information required to connect to a database. I have used the following
code to get the xml file into my program as an object, and this works
beautifully, as long as I directly call it from my codebehind.
Dim MyConfigXml As New System.Xml.XmlDataDocument
MyConfigXml.Load(aHttpServUtil.MapPath("My.config"))
However, as the settings are common I would like to use this in a static
method (sorry, just realised, I mean shared function - I learnt programing
in java mainly, so I sometimes mix up the terms) of an object, and call it
from all my pages. Unfortunately, when I do
this the MapPath gives compiler errors, and I have to manually enter the
entire path into the method. Are there any other ways of getting the path -
the path of the config file is the same as that of all of my .vb files. I am
using the VB.net language, .net framework 1.1 and VS.net 2003.
Thanks,
Martin