In asp.net, how does one use an encrypted database to connect strings to ensure data security?

Source: Internet
Author: User

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 :)

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.