G
Guest
Is there a way to create an application wide connection object in C# so I
don’t have to create a new one for every page? My issue is that while I can
do this within the scope of a single aspx page. It can really drag down
performance because each portion of the page is made up of user controls,
each with a connection object within its scope. I like to have one public
connection object per user session and just open and close it as I need it,
but scope is preventing the pages from seeing the connection object
SqlConnection objConnection = new
SqlConnection(System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]);
don’t have to create a new one for every page? My issue is that while I can
do this within the scope of a single aspx page. It can really drag down
performance because each portion of the page is made up of user controls,
each with a connection object within its scope. I like to have one public
connection object per user session and just open and close it as I need it,
but scope is preventing the pages from seeing the connection object
SqlConnection objConnection = new
SqlConnection(System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]);