views:

171

answers:

2

We are using ASP.NET 3.5 and C# 3.0.

According to the client's requirement, the database connection string need to be stored in system registry.During the connection establishment,we have to read the connection string from System Registry.

How can i store connection string in System Registry?

Using C# how can i programmatically read my connectionString?

Storing connectionString in System's registry is a good practice?

+2  A: 

Please, read following article: Read, write and delete from registry with C#

If it's a good practice? IMHO, I don't think so. Your web application can be hosted in multiple machines, and all them needs to store same key.

Rubens Farias
A: 

Here is information about how to access the registry from C#.

You can store the connection string in the registry, though that's not a very common practice these days. Whether it is a good idea depends on the security requirements and on how well locked-down the PC's are where this will run.

Since the inception of .NET, there has been a trend to pull this type of configuration information out of the registry and into configuration files.

Eric J.