T
Tim_Mac
hi,
i'm trying to read the system.web section of the web.config in my web
application.
the problem is that the configuration returned is not the one in my
application root.
i've tried all sorts of variations to load my web.config, but they are
not picking up the right version of web.config.
this is the code i'm using:
Configuration config =
WebConfigurationManager.OpenWebConfiguration("~");
SystemWebSectionGroup systemWeb = config.GetSectionGroup("system.web")
as SystemWebSectionGroup;
return
systemWeb.SiteMap.Providers[0].ElementInformation.Properties["siteMapFile"].Value.ToString();
the correct value should be 'App_Data/web.sitemap' but it is always
returning 'web.sitemap' which is in the global web.config.
any ideas? i don't want to hard code the name of the web site that i
have deployed to, as this could easily change. i just want the
'current' web.config.
thanks
tim
i'm trying to read the system.web section of the web.config in my web
application.
the problem is that the configuration returned is not the one in my
application root.
i've tried all sorts of variations to load my web.config, but they are
not picking up the right version of web.config.
this is the code i'm using:
Configuration config =
WebConfigurationManager.OpenWebConfiguration("~");
SystemWebSectionGroup systemWeb = config.GetSectionGroup("system.web")
as SystemWebSectionGroup;
return
systemWeb.SiteMap.Providers[0].ElementInformation.Properties["siteMapFile"].Value.ToString();
the correct value should be 'App_Data/web.sitemap' but it is always
returning 'web.sitemap' which is in the global web.config.
any ideas? i don't want to hard code the name of the web site that i
have deployed to, as this could easily change. i just want the
'current' web.config.
thanks
tim