Article ID: 821616 - Last Review: April 19, 2007 - Revision: 2.8 INFO: Usage of Strong Credentials to Store Connection Strings in the SessionState ElementSUMMARYIMPORTANT: This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base: 256986
(http://support.microsoft.com/kb/256986/EN-US/
)
Description of the Microsoft Windows Registry This article describes how to store the encrypted
sqlConnectionString property and the stateConnectionString property for the <sessionState> element in the registry in a security-enhanced way. MORE INFORMATIONBy default, ASP.NET stores the ConnectionString property for a session state in plain text. You use encryption to increase the protection of ConnectionString. You can use the Aspnet_setreg.exe utility to encrypt and then to store the ConnectionString attribute values in the registry under a secure key. You can download Aspnet_setreg.exe from the following link: Download the Aspnet_setreq.exe package now (http://download.microsoft.com/download/2/9/8/29829651-e0f0-412e-92d0-e79da46fd7a5/aspnet_setreg.exe) Additionally, this article describes how to use the Aspnet_setreg.exe utility to encrypt credentials and session state connection strings. The sessionState element configures session state settings for the current application. You can use the encrypted data that the registry stores instead of plain text in the sessionState configuration section. Aspnet_setreg.exe UtilityUse the Aspnet_setreg.exe utility to encrypt and then to store connection string 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 the CryptUnprotectData function, 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. The ASP.NET worker process (Aspnet_wp.exe) reads the <sessionState/> sections. To read the 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. Use Encrypted Attributes in the Configuration File for the SessionState ElementWARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk. Note This tool creates the registry keys under the HKEY_LOCAL_MACHINE subtree. By default, only administrators can create keys under this key. Make sure that you are logged on as an administrator to successfully create the registry keys.
Use Registry Editor to Grant Permissions for the ASP.NET Account on These Registry KeysWARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.
REFERENCESFor more information about session state, visit the following Microsoft Developer Network (MSDN) Web site:
http://msdn2.microsoft.com/en-us/library/h6bb9cz9(vs.71).aspx
(http://msdn2.microsoft.com/en-us/library/h6bb9cz9(vs.71).aspx)
For additional information about session state, click the following article numbers to view the articles in the Microsoft Knowledge Base: 329250
(http://support.microsoft.com/kb/329250/
)
FIX: Stronger Credentials for processModel, identity, and sessionState
329290
(http://support.microsoft.com/kb/329290/
)
HOW TO: Use the ASP.NET Utility to Encrypt Credentials and Session State Connection Strings
| Article Translations
|
Back to the top
