Last post Oct 07, 2008 06:59 PM by ricka6
Oct 07, 2008 03:49 PM|soccerwiz|LINK
I have a common connection string problem that I need some assistance with.
In my web application, I have multiple clients, each with their own database. I determine who the client is based on the URL. For example,
www.website.com/testclient. Once I determine the client, I need to set their connection string. I have multiple connect strings in a connection.config file that I reference in my web.config file.
Can I create a connection string in the global.asax, then change the above line to reference that connect string? Would that persist throughout the session, or do I have to add code to each user control to reference that connection string?
For example, can I do something like this?
this._connection.ConnectionString = cs.ConnectionString; in dataset;
ASP.NET Dynamic Data
Oct 07, 2008 05:19 PM|jtlembke|LINK
If you are using regular ASP.NET, you could do that in global.asax, or in a Master page. I would just read the config file for the right connection string each time the page loads.
Am I getting you on this?
Also, are you using Dynamic Data or just regular ASP.NET?
Oct 07, 2008 06:07 PM|sjnaughton|LINK
Hi Soccerwiz, if this is DD your on to a looser here as the Model is setup in Application Start not Session Start [:'(]
Hope this helps [:D]
Oct 07, 2008 06:19 PM|ricka6|LINK
If this is a generic ASP.NET question and not Dynamic Data specific can you try posting in http://forums.asp.net/default.aspx?GroupID=16 ?
I would write a method that passes the request (URL) and returns the connection string based on parsing the URL.
Oct 07, 2008 06:56 PM|soccerwiz|LINK
Can I move this post, or do I have to repost in another section?
Oct 07, 2008 06:59 PM|ricka6|LINK
I think you'll have to repost.