473,387 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Managing many connection strings (ASP.NET 2.0)

Hi all.

I am developing a web application, which should be able to retrieve
data from many databases. In Web.Config I created three named
connection strings.

My app consists of DAL, BLL and Presentation Layer. In GUI user shuld
be able to select database, which he wants to work with. I can store
connection string of selected DB in Session, but I have problems with
passing it to DAL through BLL. My BLL classes are normal cs files and
they do not have access to Session. Of course I can pass this.Page
parameter to BLL and then use page.Session, but I find this solution a
bit clumsy.

Does anybody know a better solution to this? I am sure that many of you
faced the same problem as I do, so I would like to know your solutions.

Thanks in advance,
Piotrek

Jul 21 '06 #1
2 1261
Hi,

you could have intermediate class used to represent the session (or
settings), perhaps implementing some interface, which you can pass to BLL .
It's right way to do it, so that BLL etc knows anothing about ASP.NET's
session. It can have session concept but that's loose from the session
implementation of the underlying platform.

I've discussed some of it, in a blog post

ASP.NET's Session and business components
http://aspadvice.com/blogs/joteke/ar.../23/16785.aspx

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

"Piotrek" <pt*********@poczta.fmwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Hi all.

I am developing a web application, which should be able to retrieve
data from many databases. In Web.Config I created three named
connection strings.

My app consists of DAL, BLL and Presentation Layer. In GUI user shuld
be able to select database, which he wants to work with. I can store
connection string of selected DB in Session, but I have problems with
passing it to DAL through BLL. My BLL classes are normal cs files and
they do not have access to Session. Of course I can pass this.Page
parameter to BLL and then use page.Session, but I find this solution a
bit clumsy.

Does anybody know a better solution to this? I am sure that many of you
faced the same problem as I do, so I would like to know your solutions.

Thanks in advance,
Piotrek

Jul 21 '06 #2
Thanks Teemu, you helped me a lot.

Piotrek.

Jul 21 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Nick Gilbert | last post by:
Hi, I have an asp.net application which runs from a CD-ROM using Cassini. As such, it is single user only. The application connects to an Access database when it is loaded, and keeps the same...
16
by: peshekeedweller | last post by:
Using asp.net 1.1. vb.net 2003. I am trying to connect to a remote sql server 2000 on a virtual machine running windows 2000 server. I can connect through the server explorer in visual studio,...
7
by: Gary Brizard | last post by:
OK. For an n-tier architecture, where is the best place to store the connection string for the DA layer? I don't want to use the reg. Can't use a app.config for a dll. For other projects I...
14
by: WebMatrix | last post by:
Hello, I have developed a web application that connects to 2 different database servers. The connection strings with db username + password are stored in web.config file. After a code review,...
5
by: Darrel | last post by:
I've been taught that, at least in 1.1, you put your DB connection strings in the WebConfig file and access them from there as needed. In 2.0, it looks like I can do the same, but it's been...
5
by: Matt | last post by:
Hello, What is the best way to handle the database connection string for a class library project that will be compiled and used as a .dll? This .dll will be accessed via classic ASP and in...
11
by: =?Utf-8?B?UGF0Qg==?= | last post by:
Is there a way in ASP.NET 2.0 to have different connection strings settings in a web.config files that are dynamically used based upon the server that the web application is running on? For...
9
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I have a question about storing the connection strings to the database in a config file or database. My manager wants me to store all the connection strings in a database, but I...
2
by: Johnson | last post by:
I'm trying to fix a "sub optimal" situation with respect to connection string management. Your thoughtful responses will be appreciated. I just started with a new client who has a bunch of legacy...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.