Subject: connection string
Posted By: nalla Post Date: 1/6/2006 3:58:19 AM


Hi,

(1) What's the best place to store connection string in a ASP.Net project?
(2) How can I access it in asp pages?
(3) What's the solution for global variables in a ASP.Net project?

Thanx.




Reply By: planoie Reply Date: 1/6/2006 8:47:48 AM
1. Most recommend you put the connection string in the web.config file: br / br / <appSettings file= user.config > br /   <add key= CONNSTRING value= <your connection string here> /> br / </appSettings> br / br / 2. Retrieve it using System.Configuration.ConfigurationSettings: br / C#: System.Configuration.ConfigurationSettings.AppSettings[ CONNSTRING
VB: System.Configuration.ConfigurationSettings.AppSettings("CONNSTRING")

3. Avoid using them.  A properly designed application shouldn't need them.  What would you intend to use them for?  There may be better solutions depending on what you want to do.

-Peter
Reply By: nalla Reply Date: 1/23/2006 3:03:55 AM

Hi peter,

Thank you very much.


nalaka hewage

Go to topic 39054

Return to index page 388
Return to index page 387
Return to index page 386
Return to index page 385
Return to index page 384
Return to index page 383
Return to index page 382
Return to index page 381
Return to index page 380
Return to index page 379