arrtchiu
July 25th, 2009, 09:56 PM
Hi guys,
I'm sure this is a total noob question to you, but I'm finding it quite hard to locate an answer to this!
I want to be able to read strings from an XML file so I can use them in my code.
The thing is, I want to do this from within a class, which means I can't use the xmlDataSource control (like <asp:xmlDataSource.....)
All of the examples I find either use the xmlDataSource control (which seems like it needs to be put on a page) or a relative path (like @"C:\myxmlfile.xml")
I can't use a relative path because that will prevent the app from being moved around (without having to modify variables)
have been trying it like this:
XmlReader r = XmlReader.Create("~/App_Data/LwICTProxy_Services.xml");
If anyone can help me it would be greatly appreciated :)
I'm sure this is a total noob question to you, but I'm finding it quite hard to locate an answer to this!
I want to be able to read strings from an XML file so I can use them in my code.
The thing is, I want to do this from within a class, which means I can't use the xmlDataSource control (like <asp:xmlDataSource.....)
All of the examples I find either use the xmlDataSource control (which seems like it needs to be put on a page) or a relative path (like @"C:\myxmlfile.xml")
I can't use a relative path because that will prevent the app from being moved around (without having to modify variables)
have been trying it like this:
XmlReader r = XmlReader.Create("~/App_Data/LwICTProxy_Services.xml");
If anyone can help me it would be greatly appreciated :)