1

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?

1
  • 1
    why the registry? Why don't you use the standard, accepted .NET way of doing things - store connection strings in the web.config file? Commented Oct 11, 2009 at 20:52

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.