In asp.net, how does one use an encrypted database to connect strings to ensure data security?
When we publish a website, encrypt web. config to effectively ensure the security of database users and passwords. The steps are as follows:
1. Add a key
Run: C: \ WINDOWS \ Microsoft. NET \ Framework \ v2.0.50727 \ aspnet_regiis-pc "hnlaw"-exp
"Hnlaw" is the key name.
2. Add a web. config Node
In the web. config Between:
Note: Here keyContainerName = "hnlaw" and name = "hnlaw" respectively indicate your key name;
3. encrypt web. config
Add a batch file enweb. bat to the root directory of the website. The content is as follows:
The Code is as follows:
@ Echo off
C: \ WINDOWS \ Microsoft. NET \ Framework \ v2.0.50727 \ aspnet_regiis-Arg "system. web/identity" "E: \ HS Studio \ Donet2 \ Hnlawyer"-prov
"Hnlaw"
C: \ WINDOWS \ Microsoft. NET \ Framework \ v2.0.50727 \ aspnet_regiis-Arg "connectionStrings" "E: \ HS Studio \ Donet2 \ Hnlawyer"-prov
"Hnlaw"
PAUSE
Register the above path and name!
It appears successfully after running!
4. decryption
Add a batch file deweb. bat to the root directory of the website. The content is as follows:
The Code is as follows:
@ Echo off
C: \ WINDOWS \ Microsoft. NET \ Framework \ v2.0.50727 \ aspnet_regiis-Arg "system. web/identity" "E: \ HS Studio \ Donet2 \ Hnlawyer"
C: \ WINDOWS \ Microsoft. NET \ Framework \ v2.0.50727 \ aspnet_regiis-pdf "connectionStrings" "E: \ HS Studio \ Donet2 \ Hnlawyer"
PAUSE
Finally, you should note that after you finish the process, find the C: \ Documents ents and Settings \ All Users \ Application Data \ Microsoft \ Crypto \ RSA \ MachineKeys directory and find the generated
The key file (which can be searched by Time) can be read by The network service. Otherwise, an Error message from the provider: The RSA key container cocould will appear.
Not be opened.
Unable to read
This may happen. If you do not have your own server and you do not have the permission to modify the MachineKeys directory, you do not know any other solutions. I hope you can share them with us :)