Click here to Skip to main content
15,884,702 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am using 2 config files in my project. One is Web.config and another is web1.config.
Please see the code below. But, it is not working.

Actually i added web1.config file after completing my project and in all form I used the code:
VB
System.Configuration.ConfigurationManager.AppSettings("gridrows").ToString()


In web.config file:
appSettings configSource=Web1.config
In web1.config file:
appSettings
add key=gridrows value=10


[Moved from Answer]

I m using vb.net and getting error
"The format of a configSource file must be an element containing the name of the section."
I did like this:
VB
gridMain.PageSize = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings("gridrows").ToString())

[/Moved from Answer]
Posted
Updated 28-Jul-10 20:36pm
v3
Comments
Sandeep Mewara 29-Jul-10 1:42am    
So what was the problem? Not working meaning?
Sandeep Mewara 29-Jul-10 1:45am    
Technically, you cannot use TWO 'Web.Config' files. But you are using two config files, one Web.config and other web1.config so it should be fine.
Shining Legend 29-Jul-10 5:22am    
if you have more than 1 web.config file in a project. it should be put in sub directory. its not correct to have 2 configuration files in same directory.

Its actually fine but still u can

try dis

System.Configuration.ConfigurationManager.AppSettings["gridrows"].ToString() <br />

or do refer..
http://goo.gl/vFQT
and
http://goo.gl/7lhi
 
Share this answer
 
where u add web.config file in root directory or child directiry....
 
Share this answer
 
Comments
Sandeep Mewara 29-Jul-10 1:51am    
Reason for my vote of 1
Sounds more like a question. Should be posted as a comment.

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