Web. config database connection decryption

Source: Internet
Author: User

Web. config database connection
 
<ConnectionStrings>
<Add name = "EnterpriseWebConnectionString" connectionString = "Data Source =.; Initial Catalog = Enterprise; User ID = sa; Password = 1391018" providerName = "System. Data. SqlClient"/>
</ConnectionStrings>
 
 
 
How to encrypt Data Source =.; Initial Catalog = Enterprise; User ID = sa; Password = 1391018 "providerName =" System. Data. SqlClient?
How to call it in a program? Can you give an example? Is there any small tool for encryption and decryption?
 
1.. NET itself provides encryption algorithms with An Encrypt namespace, symmetric and asymmetric. Of course, you can also design your own encryption algorithm.
2. connection strings are usually stored in Web applications and Winform applications. config or app. and provides a corresponding Singleton mode class to provide access to the connection string.
3. What you need to do is to use the Singleton class to retrieve the ciphertext of the Connection string before each Connection, decrypt the string, and then pass the plaintext as a parameter to the constructor of the Connection object for Connection.
 
 
 
Encrypted connection string
 
@ Echo off
C: \ WINDOWS \ Microsoft. NET \ Framework \ v2.0.50727 \ aspnet_regiis.exe-Arg "connectionStrings" "C: \ Program Files \ Microsoft \. NET Pet Shop 4.0 \ Web"
PAUSE
Connection string decryption
@ Echo off
C: \ WINDOWS \ Microsoft. NET \ Framework \ v2.0.50727 \ aspnet_regiis.exe-pdf "connectionStrings" "C: \ Program Files \ Microsoft \. NET Pet Shop 4.0 \ Web"
PAUSE
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.