Article ID: 329290 - Last Review: October 29, 2007 - Revision: 8.7 How to use the ASP.NET utility to encrypt credentials and session state connection stringsThis article was previously published under Q329290 On This PageSUMMARY 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:
IntroductionUse 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 IISFor 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, click 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. MORE INFORMATIONDownload and run Aspnet_setreg.exeThe following file is available for download from the Microsoft Download Center:Collapse this image ![]() Release Date: April 11, 2003 For more information about how to download Microsoft support files, click the following article number to view the article in the Microsoft Knowledge Base: 119591
(http://support.microsoft.com/kb/119591/
)
How to obtain Microsoft support files from online services
Microsoft scanned this file for viruses. Microsoft used the most
current virus-detection software that was available on the date that the file
was posted. The file is stored on security-enhanced servers that help prevent
any unauthorized changes to the file.
To display all the available command-line switches and their usage, run this tool from the command prompt without any command-line switches. If you saved this tool to C:\Tools\, run the following command from the command prompt to display all of its available switches and help for the switches:
C:\Tools>aspnet_setreg.exe Use encrypted attributes in the configuration fileImportant This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:322756
(http://support.microsoft.com/kb/322756/
)
How to back up and restore the registry in Windows Note This tool creates the registry keys under the HKEY_LOCAL_MACHINE subtree. By default, only administrators can create keys under this subtree. Make sure that you are logged on as an administrator to successfully create these registry keys.
Use Regedt32.exe to grant permissions for the ASP.NET account on these registry keysImportant This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:322756
(http://support.microsoft.com/kb/322756/
)
How to back up and restore the registry in Windows
REFERENCES
For more information about a hotfix that lets you use the
features that are described in this article, click the following article number to view the article in the Microsoft Knowledge Base:
329250
(http://support.microsoft.com/kb/329250/
)
FIX: Stronger credentials for processModel, identity, and
sessionState
Note
The fix that is described in article 329250 is only available for the .NET Framework 1.0.For more information about the Microsoft Windows registry, click the following article number to view the article in the Microsoft Knowledge Base: 256986
(http://support.microsoft.com/kb/256986/
)
Description of the Microsoft Windows registry
For more information about ASP.NET, click the following
article numbers to view the articles in the Microsoft Knowledge Base: 315158
(http://support.microsoft.com/kb/315158/
)
FIX: ASP.NET does not work with the default ASPNET account on a domain controller
Note
The fix that is described in article 315158 is only available for the .NET Framework 1.0.317012
(http://support.microsoft.com/kb/317012/
)
Process and request identity in ASP.NET
| Article Translations
|

Back to the top

