This article is a mirror article of machine translation, please click here to jump to the original article.

View: 21304|Reply: 0

[Source] c# EF encrypts database connection strings

[Copy link]
Posted on 11/1/2016 2:55:47 PM | | | |


This is the link string I used to encrypt, which can also query the data without throwing any exceptions.

Original writing:

web.config



The above is the default writing, and the following is the encrypted writing.

We can write the connection string directly into the parent class construction method, since we can write the connection string directly into it,

In other words, we write the encrypted connection string to the appsettings of web.config, and then we take out the value according to the key.

Wouldn't it be enough for us to write another method to decrypt it into the correct connection string???



I wrote this article because last week someone in the QQ group asked EF how to encrypt the link string, and then the members of the group offered suggestions, some people said this, some people said that, and each had their own opinions.

In the end, it seemed that it had been done for more than half an hour, and the group was still discussing, but today, suddenly, I wanted to try it myself, and as a result, I got it done in a minute。。。。。。。




Previous:C# application adds xml configuration file
Next:C# Writing High-Performance Tcp Socket Application Considerations
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com