Sukumar Raju's Blog

MCP

Sponsors

Tags

News

SharePoint SharePoint

More reading these days Patterns and practicces


Interesting to work with ASP.NET Membership provider

Suggested Reading C# Book


patterns & practices Application Architecture Guide 2.0


MVP Blog Badge.

Grab this badge here!


February 2011 - Posts

Encrypt and Decrypt connectionStrings section in Web.config using ASPNET_REGIIS utility

Encrypting and decrypting connectionStrings section progrmatically is explained in this article from my blog.

Using aspnet_regiis.exe utility from Microsoft .NET framework it is quite easy and straight forward to encrypt and decrypt connectionStrings section in Web.config to protect sensitive data.

1. Open Visual studio command prompt window from Programs

VisualStudio_Command_Prompt

2. Navigate to the folder where the application stored with in File system

3. Utilising aspnet_regiis.exe utility use below shown command to encrypt connectionStrings section.

c:/>aspnet_regiis -pef connectionStrings .

In the above command P stands for protection, E stands Encryption and F file system. . [DOT] for current location

Command_Line_Utility

Note: Make sure to navigate inside the website/web application project in file system. 

That is it. ConnectionStrings section gets encrypted using RSA pubic key encryption to encrypt and decrypt data.

Note that in order to decrypt the same section use >aspnet_regiis –def connectionStrings .

References

http://msdn.microsoft.com/en-us/library/k6h9cz8h%28v=VS.90%29.aspx

Video: http://msdn.microsoft.com/en-us/security/bb977434

Access controls with in Change Password control

In order to access controls with in Change Password control

1. Change the control to Template by going to design mode then smart tag
2. Choose Convert to Template

//Access the Cancel button which is with in ChangePassworTemplateContainer  as below, it would be similar for other controls

//Get a reference to button, which is in ChangePasswordTemplateContainer
Button btnCancel = (Button)
ChangePassword1.ChangePasswordTemplateContainer.FindControl("Control_ID”);
            if (btnCancel != null)
            {
               //Action to perform
            }
References
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.changepassword.aspx
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/login/changepassword.aspx
More Posts