Creating a custom .Config file

J

Jarod_24

I Created a .config file for my Web application and named it
"Settings.config"

The file contains some settings for the application, including a connection
string to a database.

But i don't see how a System.Configuration. class finds the file.

I expected to be doing something like this:

'I just use 'AppSettingsReader' as an example here

Dim k as New system.Configuration.AppSettingsReader
k.Filename = mypath & "Settings.config"

Dim s As String = CType( k.GetValue("Connectionstring"), String)

But i don't find a .Filename property, and that tells me that you can only
use these Classes with the 'standard' .config files. The files that .Net
expect to be there; Like machine.config and maybe web.config.

How do i get to read values from my Custom .config file?
 
J

Jarod_24

Paul Wistrand said:
Why not just use web.config?

Maybe i'm just weird, but i'd prefer to have my own custom .config file, and
not start mixing up these things with all the generic .net settings that are
in there.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top