473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

can't find 'current' web.config with OpenWebConfiguration

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

Apr 20 '06 #1
0 1809

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: hilary321 | last post by:
Hi- I am using ASP.NET 2.0. I would like to have a generic function in my application that will determine what type of authentication to use and then proceed with authentication, either Windows...
9
by: ad | last post by:
I used login Controls of VS2005 to develop Web application. My program will check password and user ID in login.aspx. If the password is wrong, my program will display an "password is wrong"...
0
by: vikramp | last post by:
Hi, I am storing theme in web.config using <pages theme="mytheme"/>. I am then using the following code to read it from my webpage: Configuration config =...
2
by: bibhuti.nilesh | last post by:
I want to read web. config file and need to get values of appSettings through a console application
0
by: Alias | last post by:
Hi - I have a site that runs on a development and production server. I'd like to programmatically change the connection string the provider uses in the web.config file and have the provider use...
6
by: =?Utf-8?B?Um9nZXIgTWFydGlu?= | last post by:
I have configuration data for a web application stored in a file galleryserverpro.config located in a config folder off the root application. Web.config references this file like this:...
2
by: =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= | last post by:
I've tried: MailSettingsSectionGroup mailConfig = WebConfigurationManager.GetSection("system.net/mailSettings") as MailSettingsSectionGroup; and: Configuration configurationFile =...
4
by: pasam | last post by:
Hi I am creating installer for asp.net i am using this code for to modify web.config file but i cant whats wrong this code ' Get configuration. Dim config As Configuration =...
5
by: gr8Ashish | last post by:
hi all i am using a windows application as well as web application developed in visual studio 2010 beta 2 using .net framework 4 on windows xp/windows server 2008/windows7 i am...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.