Re: web.config question 2.0



Thanks so much! It's now working! The reason we want all our apps to use
one set of connection strings is because we have several different domains
and dev, test and production servers on each of them, all with different
server names. Inevitably someone forgets to change the web.config when the
upgrade 15 different servers; best case the app gets an error, worse case
someone is hitting a test server database without realizing it. Of course,
this shouldn't happen, but it did, so we're putting as much into place as we
can to prevent that. We're starting with a main web.config on each server
to contain the connection strings for all our apps to use.

"eagle" <eagletender2001@xxxxxxxxx> wrote in message
news:OpmrRvjxHHA.536@xxxxxxxxxxxxxxxxxxxxxxx
I have a web.config in my application that contains the connection strings
to all my datasources. I want to move these connection strings to another
web config up the folder hierarchy so that all my apps can use the same
connection strings. That is supposed to be how it's done, no? Instead of
the web.config being in c:\inetpub\wwwroot\myApp\web.config, I have it in
c:\inetpub\wwwroot\web.config. However, I get an "Object reference not
set
to an instance of an object" error when I do this. This used to work fine
in Visual Studio 2003 .net 1.0.

My connection string is fine:

<connectionStrings>
<add name="myDB" connectionString="Data Source=mySvr;Initial
Catalog=myDB;Integrated Security=True "/>
</connectionStrings>

And this is how I retrieve in in the web app:

_sSQLConn =
System.Configuration.ConfigurationManager.ConnectionStrings("myDB").ToString

What am I doing wrong?

Thanks for your help.







.



Relevant Pages

  • Re: Connection string / design question
    ... Hitchhiker's Guide to Visual Studio and SQL Server ... I have a question regarding the handling of connection strings. ... application - windows forms apps, web apps, web services and windows ... them connect to the same database. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: web.config question 2.0
    ... they think we should upgrade all our 1.0 ... all our thousands of apps to that new component. ... of our apps are stored in source safe. ... I want to move these connection strings to another ...
    (microsoft.public.dotnet.framework.aspnet)
  • Connection string / design question
    ... I have a question regarding the handling of connection strings. ... application - windows forms apps, web apps, web services and windows ... them connect to the same database. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: web.config question 2.0
    ... I want to move these connection strings to another web config up the ... folder hierarchy so that all my apps can use the same connection strings. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: D8: first impression and uneasy feeling... (long)
    ... pack server apps and gui apps. ... I think people that defends .net here is people doing mostly server ... Borland has an incredible potential here, but it has to realize there ... with a .NET server and a win32 client. ...
    (borland.public.delphi.non-technical)