? SET PASSWORD THROUGH CODE in Connectionstring
-
hii i want know that when we add any data source to the project it has two options 1. No, exclude sensitive data from the connection string, i will add in my application code 2. Yes, include sensitive data in my connection string 2nd option is nuthing anyone can use it but how to use the first option ??? how to add sensitive data in application code ??? how can i do that please provide any easy way as i didnt find it thanks with regards k
-
hii i want know that when we add any data source to the project it has two options 1. No, exclude sensitive data from the connection string, i will add in my application code 2. Yes, include sensitive data in my connection string 2nd option is nuthing anyone can use it but how to use the first option ??? how to add sensitive data in application code ??? how can i do that please provide any easy way as i didnt find it thanks with regards k
1: have a look at the SqlConnectionStringBuilder class, as this will give you the ability to change the password within a connection string: http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnectionstringbuilder.aspx[^] Using this class, you can store the full connection string, with a dummy password in the app.confg file. Then, when you want to use it in code, you can use the SqlConnectStringBuilder class to alter the string so that it includes the correct password. 2: Have a look at this article, as I believe it does exactly what you want: Encrypt and Decrypt ConnectionString in app.config and/or web.config![^]