Web.config...?

  • Thread starter Thread starter Kent Johnson
  • Start date Start date
K

Kent Johnson

Hi all,

I have a lot of connection strings for a specific database on SQL-server in
my application.
Seen that there's a sqlConnectionString in Web.config.
Can I use web.config to store the info about the connectionstring there?
How do I call it from the application?


/Kent J.
 
No that's for SQL Server sessions. But you can add this to your
web.config... make sure it's OUTSIDE the <system.web>

<appSettings>
<add key="ConnectionString"
value="server=localhost;Trusted_Connection=true;database=Commerce" />
</appSettings>


Then call it by:
ConfigurationSettings.AppSettings("ConnectionString")


Some say it's not good to put the connection string here. Microsoft has a
history of leaving gaping security holes. Remember when the global.asa could
be read for a URL just by typing global.asa+htr ?? So many databases were
comprimised LOL !!
 
Max,
OK! Many thanks

/Kent J.



Max said:
No that's for SQL Server sessions. But you can add this to your
web.config... make sure it's OUTSIDE the <system.web>

<appSettings>
<add key="ConnectionString"
value="server=localhost;Trusted_Connection=true;database=Commerce" />
</appSettings>


Then call it by:
ConfigurationSettings.AppSettings("ConnectionString")


Some say it's not good to put the connection string here. Microsoft has a
history of leaving gaping security holes. Remember when the global.asa could
be read for a URL just by typing global.asa+htr ?? So many databases were
comprimised LOL !!
 
Back
Top