Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In an application I have 2 web.config files (one is at root and other is at child node).

In both web configs I have defined same key name but with different values.
So to call child web.config key value in code behind what have I to do?

Please let me know.
Somebody asked me but I am unable to give answer.

Thanks,
Chin
Posted
Updated 10-Jan-11 0:42am
v4
Comments
Sandesh M Patil 6-Jan-11 5:48am    
Improved for better understanding
Dalek Dave 10-Jan-11 6:40am    
Edited for Grammar, Syntax and Readability.

You'll need to create a custom section handler to deal
with your custom tags.

Ex
<yourcustomconfigsection> 
   <customers> 
     <customer name="Customer1" somesetting="A" another="1" /> 
     <customer name="Customer2" somesetting="B" another="2" /> 
     <customer name="Customer3" somesetting="C" another="3" /> 
   </customers> 
</yourcustomconfigsection> 


Use Google
 
Share this answer
 
v2
Comments
Member 4021845 6-Jan-11 6:32am    
Thank you...
Member 4021845 6-Jan-11 6:36am    
Any other way could we do that?
Dalek Dave 10-Jan-11 6:40am    
Good call.
Anybody please tell me how i will do it...

Question :Now Microsoft control is showing in design page like
asp:button suppose after 6 month Microsoft changed it aspppp:button.
Genrally it may not happen.if happened then how you manage your application that it will not show any problem.

Could anybody give me any idea how i will start it from first that any changes will come it will not affect.

Thnks.
Chinn
 
Share this answer
 
Comments
Estys 10-Jan-11 6:38am    
Don't think such things, there's no defense against that except a search&replace!
Kindly post new question as a new post inorder to track properly.

You have a tag getting registered in your aspx for a user control that you add to aspx.Name of tag prefix is that matters.Modify tag prefix in order to compile

<![CDATA[<%@ Register TagPrefix="UC" TagName="OfDateTime" Src="~/UserControls/TimeAnalyzer.ascx" %>

Control code:

<uc:ofdatetime id="mdtFilterStart" runat="server" />
 
Share this answer
 
v2
When you have two web.config in your application, the web.config in child will override the root web.config's keys.

For example

ROOT --> Web.Config --> AppSettings "Key1" --> "Test Root"

Child --> Web.Config --> AppSettings "Key1" --? "Test Child"


when you read the "Key1" from the child you will get "Test Child" only.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900