Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to protect the connectionstring in web.config?

I have a website about to go live. I'm wondering what I should be doing about the connectionstring in the web.config. Do I obfuscate it and it so how?

Thanks!

like image 216
Mr Cricket Avatar asked Feb 26 '23 23:02

Mr Cricket


1 Answers

The standard method is to encrypt it. http://ondotnet.com/pub/a/dotnet/2005/02/15/encryptingconnstring.html

However, another good option is to store it in the registry and set the permissions so that only the asp.net runtime can access it.

See this article: http://msdn.microsoft.com/en-us/library/ff649224.aspx and this KB: http://support.microsoft.com/kb/821616

Although I do have to say that using the registry does tend to complicate deployment and using text/staging servers a bit. We did it... ONCE and then went back to encrypting.

like image 60
David Avatar answered Mar 04 '23 00:03

David