The easiest is certainly web.config. something like:
<system.web>
<appSettings>
<add key="connString" value="my_connection_string">
</appSettings>
</system.web>
Then use this to get it out:
string connectionString = (string)
ConfigurationSettings.AppSettings("connString");
That being said, Microsoft's latest best practices for security suggest
putting it in the registry, and optionally encrypting it before storing it
there. You can use the RegistryKey class to access the registry key. I think
it's documentation is pretty straight forward.
Where you store it is all up to how much security matters to you. For a
personal site, I use web.config for the ease. For an external company site,
I suggest registry settings as it's harder to get access to those.
--
Mike Mayer, C# MVP
mi**@mag37.com http://www.mag37.com/csharp/
"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:uI**************@TK2MSFTNGP11.phx.gbl...
Selen wrote:
In asp.net what is the best way for storing connection string?
You can store that as an application setting in the web.config file of
your application.
--
Martin Honnen
http://JavaScript.FAQTs.com/