This step-by-step article describes how to use the Aspnet_setreg.exe utility to encrypt credentials and session state connection strings. Microsoft ASP.NET version 1.0 requires that you store plain text credentials in configuration files if you want to do any of the following:
Inetinfo.exe, which runs under the System identity, reads the <processModel /> section. To read the registry keys that store a user name and password for the ASP.NET worker process, the System account must have Read permission to these keys.
The ASP.NET worker process (Aspnet_wp.exe) reads the <identity /> and <sessionState /> sections. To read these registry keys, the worker process account must have Read permission to these keys. If content is hosted on a Universal Naming Convention (UNC) share, the account that is used to access the UNC share must have permission to read these keys.
By default, the registry keys that Aspnet_setreg.exe creates grant full control to the System, Administrator, and Creator Owner accounts. You can use Regedt32.exe to modify the DACL on the registry key. Make sure that arbitrary users cannot read the registry keys.
Run, type iisreset in the
Open box, and then click OK.
Note If the server that you have reconfigured is a domain controller, you may have to restart the server.
- Change the ASP.NET worker process identity.
- Specify an impersonation identity.
- Specify a connection string for session state.
- <identity userName= password= />
- <processModel userName= password= />
- <sessionState stateConnectionString= sqlConnectionString= />
Introduction
Use the Aspnet_setreg.exe utility to encrypt and to store these attribute values in the registry under a secure key. Use the CryptProtectData function with the CRYPTPROTECT_LOCAL_MACHINE flag to encrypt the credentials. Because anyone with access to the computer can call CryptUnprotectData, the encrypted data is stored under a secure registry key with a strong discretionary access control list (DACL). When ASP.NET parses the configuration file, it reads the secure registry key and then uses CryptUnprotectData to decrypt the data.Inetinfo.exe, which runs under the System identity, reads the <processModel /> section. To read the registry keys that store a user name and password for the ASP.NET worker process, the System account must have Read permission to these keys.
The ASP.NET worker process (Aspnet_wp.exe) reads the <identity /> and <sessionState /> sections. To read these registry keys, the worker process account must have Read permission to these keys. If content is hosted on a Universal Naming Convention (UNC) share, the account that is used to access the UNC share must have permission to read these keys.
By default, the registry keys that Aspnet_setreg.exe creates grant full control to the System, Administrator, and Creator Owner accounts. You can use Regedt32.exe to modify the DACL on the registry key. Make sure that arbitrary users cannot read the registry keys.
Restart IIS
For your changes to take effect, you must restart Microsoft Internet Information Services (IIS). By restarting IIS, you start a new ASP.NET worker process. To do this, click Start, clickRun, type iisreset in the
Open box, and then click OK.
Note If the server that you have reconfigured is a domain controller, you may have to restart the server.