Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# Alex_B 3/26/2008 5:01 PM
Hello,

I try to use XML-file in subdirectory of my module:
D
|
+--Cuyahoga
         |
         +--Modules
                 |
                 +--MyModule
                         |
                         +--MyXML.xml
                         |
                         +--MyModule.ascx


Load XML-file:
string PathToXml =
       UrlHelper.GetApplicationPath() + "/Modules/MyModule/MyXML.xml";

// C:/Cuyahoga/Modules/MyModule/MyXML.xml
// instead of
// D:/Cuyahoga/Modules/MyModule/MyXML.xml


What i do wrong?

Thanks.
# Alex_B 3/27/2008 12:39 PM
It's my fault, i have to do so:
string PathToXml =
       Request.PhysicalApplicationPath + "/Modules/MyModule/MyXML.xml";
# Alex_B 4/18/2008 7:49 AM
Request.PhysicalApplicationPath work only in

MySome.ascx.cs

but not in

MySomeModule.cs

How can I load XML in MySomeModule.cs ?
    public class MySomeModule : ModuleBase
    {

        public MarkesDownloadModule()
        {
                // How get the path where Cuyahoga is
                string path = ...
        }
        ...
# martijnb 4/18/2008 10:41 AM
Two options:
- Create a module setting for the physical path
- Pass the physical path to the method in the .cs file.

Unfortunately, both are not very nice, but that's the only solution I can come up with atm. Maybe others have some better ideas?
# Alex_B 4/21/2008 8:13 AM
martijnb, thanks. I use first option.