473,699 Members | 2,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to tell if web.config item is/is not inherited

Probably a very basic questions here:
When using code to look at a web.config item, how can I tell if the value
is/is not inherited? I have some common code that needs to iterate through
settings like appsettings and connectionstrin gs but I only want to look at
settings for the current web app: I would like to ignore a value if it
comes from a web.config up the folder heirarchy....it does not exist in the
current web apps web.config. And I do not want a developer to have to use a
Remove element to exclude the value just so the code can work.

Using .Net 2

Thanks

Brad
Mar 26 '07 #1
3 1270
Hi Brad,

Based on my understanding, you're using
WebConfiguratio nManager.OpenCo nfiguration() to read from web.config, you
noticed that appSettings and connectionStrin gs in the Configuration object
contain both settings inherited from parent web.config and settings in
itself. You want to know is it possible to differentiate them or only get
those settings in itself. Please correct me if I've misunderstood anything.

I've done some researching and looked into the WebConfiguratio nManager's
source code using Reflector (http://www.aisto.com/roeder/dotnet/),
unfortunately it seems not possible to only return a Configuration object
with settings from the web.config itself in current .NET framework version.
Your objective is a reasonable one and we're sorry for the inconvenience
caused. I will make sure your feedback gets forwarded to product team.

For now, I'm afraid you will have to read the web.config yourself to
determine which appsettings or connectionstrin gs are in it. I can give
further suggestion if you could elaborate more about your objective. Thanks.

In the meanwhile, you're also welcome to submit your feedback at
http://connect.microsoft.com/Main/co...ContentID=2220 which
is monitored by our product team directly. Thanks again for your feedback.

Sincerely,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Mar 27 '07 #2
Thank you for the information. I can just examine the web.config as an
xmldocument.

Brad

"Walter Wang [MSFT]" <wa****@online. microsoft.comwr ote in message
news:gP******** ******@TK2MSFTN GHUB02.phx.gbl. ..
Hi Brad,

Based on my understanding, you're using
WebConfiguratio nManager.OpenCo nfiguration() to read from web.config, you
noticed that appSettings and connectionStrin gs in the Configuration object
contain both settings inherited from parent web.config and settings in
itself. You want to know is it possible to differentiate them or only get
those settings in itself. Please correct me if I've misunderstood
anything.

I've done some researching and looked into the WebConfiguratio nManager's
source code using Reflector (http://www.aisto.com/roeder/dotnet/),
unfortunately it seems not possible to only return a Configuration object
with settings from the web.config itself in current .NET framework
version.
Your objective is a reasonable one and we're sorry for the inconvenience
caused. I will make sure your feedback gets forwarded to product team.

For now, I'm afraid you will have to read the web.config yourself to
determine which appsettings or connectionstrin gs are in it. I can give
further suggestion if you could elaborate more about your objective.
Thanks.

In the meanwhile, you're also welcome to submit your feedback at
http://connect.microsoft.com/Main/co...ContentID=2220
which
is monitored by our product team directly. Thanks again for your feedback.

Sincerely,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your
reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.

Mar 27 '07 #3
Hi Brad,

Thanks for your understanding. Please feel free to let me know if there's
anything else I can help.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Mar 28 '07 #4

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

Similar topics

13
3017
by: Maxim Khesin | last post by:
I want to have a config file with my python proggie, satisfying the following requirements: 1) support key->(value, default) 2) simple and intuitive to read and edit 3) easyly readable into a python datastructure (a dictionary?) 4) not requiring any heavy libraries needed (I am distributing my proggie as a py2exe executable and do not want to bloat the size) can you guys suggest some format for this? thanks, max
5
10520
by: BPearson | last post by:
Hello I would like to have several sites share a single web.config file. To accomplish this, I would point the root of these sites to the same folder. Is there any reason why I might not want to do this? (IIS 5 or 6 In case you're wondering why I would do this, we have many web sites on a single server, and there are groups of sites that need to share common configuration information. I'd like to ease some administration by having one...
6
1802
by: Jose Perez | last post by:
Dear All, We are experiencing a problem with web.config and the fact that it's settings are being "inherited" other applications. Our default website is configured to run "MyApplication1". The website also contains 2 Virtual Directories which run "MyApplication2" and "MyApplication3". All three applications are .NET projects. "MyApplication2" inherits a HTTPModule setting from "MyApplication1" so to fix this we have amended the...
9
6434
by: Benny Ng | last post by:
Hi,all, How to let the sub-directory to avoid the authentication control from Root's webconfig? I heard that we can add a new web.config to the sub-directory. And then we can slove the problem. Virtual directory is £ºhttp://localhost/main Sub-directory is : http://localhost/main/reminder
5
1577
by: stand__sure | last post by:
I had occasion tonight to write an installer class that changed something in a config file tonight (I had never had a need to do it, but happened upon a "How To" article that explained it in terms of a web app and decided to try it with a regular app). What I discovered was that for some reason the .config file is not being copied with Primary Output. In checking a few other apps for which I had written installers I found that they too...
12
4743
by: Ben | last post by:
I have a group of settings that I'd like to have inherited by multiple sites. I'm trying this, but it's not working. wwwroot\group\web.config wwwroot\group\site1\web.config wwwroot\group\site2\web.config Where site1 & site2 are applications.
12
13430
by: dbuchanan | last post by:
Hello, (Is this the proper newsgroup?) === Background === I am building a solution with two projects. One project is my data access layer which contains my DataSet as an xsd file. The XSD file was built by draging tables from the Data Sources pane. Auto-generated code created the files associated wtih the XSD file (xss,
6
1705
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: <galleryServerPro configSource="config\galleryserverpro.config"/> I built a custom configuration settings class (inherited from ConfigurationSection) to access this data and it works great in Full Trust. However, in Medium Trust I get a SecurityException...
5
2855
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I have a app that uses several membership/role providers. I can list these Providers with the code: Dim rootWebConfig1 As Configuration rootWebConfig1 = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath) Dim section As New MembershipSection section = rootWebConfig1.GetSection("system.web/membership")
0
8687
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9174
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9034
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8883
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7750
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5874
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4376
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3057
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2009
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.