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 !!
"Kent Johnson" <08.6044303@.telia.com> wrote in message
news:Nyhjb.33242$dP1.104349@.newsc.telia.net...
> 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.
Max,
OK! Many thanks
/Kent J.
"Max" <maximus@.portvista.com> wrote in message
news:bQhjb.55823$Pd.1199355@.twister.tampabay.rr.co m...
> 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 !!
>
> "Kent Johnson" <08.6044303@.telia.com> wrote in message
> news:Nyhjb.33242$dP1.104349@.newsc.telia.net...
> > 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.
Thursday, March 22, 2012
Web.config...?
Labels:
application,
asp,
connection,
database,
inmy,
net,
specific,
sql-server,
sqlconnectionstring,
strings,
webconfig
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment