Groups | Blog | Home
all groups > asp.net > january 2008 >

asp.net : Connection String in app.config



Jeff Dillon
1/24/2008 1:32:08 PM
Use Notepad to change the app.config. It's read at run time

Jeff

[quoted text, click to view]

Scott Roberts
1/24/2008 2:53:00 PM

[quoted text, click to view]

What do you mean by "the class uses the app.config"? If you are using
ConfigurationManager.ConnectionStrings in your class, then it will use the
config file specified by the application (web.config for a web project, or
app.config for an application). You don't have to do anything special.
Fresno Bob
1/24/2008 8:26:42 PM
I am creating data access layer with strongly typed datasets in a class
library included in a Website Project. My website uses a web.config file to
store the connection string but the class uses the app.config.

When I deploy my application is there any way of changing the app config
without recompiling the application. I have never done this before so I am
not sure how it works.

Regards, Chris.

Fresno Bob
1/25/2008 7:58:43 AM
I have a website website in my solution as well as two class libraries, one
for my business layer and one for my data access layer. The DAL is made up
of strongly typed datasets using the app config to get the connection
string.

I have added references within my website to the BLL and DAL projects so
when I compile the project they get added to the bin of the website. I can't
see a way of changing the app.config whithin my website as it doesn't get
added the website on compilation. I am sure there must be a way of changing
it at run time I just can't see how.

Regards, Chris.



[quoted text, click to view]

Scott Roberts
1/25/2008 9:41:24 AM
Bob,

What makes you think that the DAL is using app.config to get the connection
string? Have you tried simply putting the connection string into web.config?


[quoted text, click to view]

AddThis Social Bookmark Button