PDA

View Full Version : retreiving value from configuration file?


fireblade
09-27-2007, 01:01 AM
hoW to retreive value from CONFIGURATION File? which code can i use to do that? is the method for windows application and web application differs?

nikkiH
09-27-2007, 03:26 PM
That depends on which version of .NET you use. 1.1 and 2.0 are a little different (2.0 deprecated the class).

Learning to read the documentation and use it effectively isn't the easiest thing in the world, but give it a shot.
http://msdn2.microsoft.com/en-us/library/system.configuration.configuration.appsettings.aspx

If you still can't get it, post whether you're using web forms or windows forms, if it's in app.config or web.config, and if you use 1.1 or 2.0.

fireblade
09-27-2007, 03:36 PM
i am using dotnet 2.0
i need for both web & windows application

thnks in advance

nikkiH
09-27-2007, 10:06 PM
For 2.0, I believe the ConfigurationManager class covers both windows forms and web forms.
http://msdn2.microsoft.com/en-us/library/system.configuration.configurationmanager(vs.80).aspx

fireblade
09-27-2007, 11:01 PM
yap.
you are right. first i used configurationManager. it dint not accept and shown error.
after i referenced the system.configuration class from the addreference, it worked.

Thanks