app.config & web.config

I have a solution file which includes DAL project,BLL and web project.

my web application is using web.config for connection string and DAL is using app.config and it makes problem for me when I publish the web site. because every time I wanna to change the connection I have to republish the web site.

I was wondering is there any way that app.config or even my datasets in DAL get the connection string from web.config file?

I googled it but i didn't find any good soloutions.Sad

Thanks. 

 

 

0
maryamsh
9/9/2008 6:33:31 PM
asp.net.config-deploy 12495 articles. 0 followers. Follow

3 Replies
986 Views

Similar Articles

[PageSpeed] 40
Get it on Google Play
Get it on Apple App Store

Friend, you can use the connection string specified in the Web.Config itself in the DAL layer. Here
logic to implement it

http://forums.asp.net/p/1133144/1819380.aspx#1819380

Hope it helped you. Good luck!

 


Please Don't forget to click "Mark as Answer" on the post that helped you.
This can be beneficial to other community members reading the thread.
0
cv_vikram
9/9/2008 7:53:28 PM

 I think you're kind of approaching it wrong. The DAL should have all your DB connection information and you should be referenceing the DAL in the BLL and the BLL from the Presentation layer. There should not be any connection information in the web project if you are indeed using a 3 tier approach.


"Hokey religions and ancient weapons are no match for a good blaster at your side."
0
DarthSwian
9/9/2008 7:55:13 PM

where should I put this code?

 ConnectionStringSettingsCollection connectionStrings = WebConfigurationManager.ConnectionStrings  as ConnectionStringSettingsCollection;

ConnectionStringSettingsCollection : in System.Configuration

WebConfigurationManager : in System.Web.Configuration

 

0
maryamsh
9/9/2008 8:20:42 PM
Reply: