Thursday, December 9, 2010

Encrypted Connection Strings using aspnet_regiis.exe

I had a task to encrypt connectionstrings of a project, i decided to use aspnet_regiis.exe file which i studied for my MCTS certification paper

Using Visual Studio Command Prompt,

Encrypt ConnectionString
[Generic form for encrypting the Web.config file for a particular website]
Inorder to encrypt specifying a path to physical directory
aspnet_regiis.exe -pef section physical_directory –prov provider
-- OR --
In order to encrypt with the name of virtual directory
aspnet_regiis.exe -pe section -app virtual_directory –prov provider

Example:
aspnet_regiis.exe -pef "connectionStrings" "D:\Publish\MyProject\1" –prov "DataProtectionConfigurationProvider"
-- OR --
aspnet_regiis.exe -pe "connectionStrings" -app "/MySite" –prov "DataProtectionConfigurationProvider"
*Note: This will add encrypteddata, cipherdata, ciphervalue tags in connectionstrings tag
----------------------------------
Decrypt ConnectionString
[Generic form for decrypting the Web.config file for a particular website]
Inorder to decrypt specifying a path to physical directory
aspnet_regiis.exe -pdf section physical_directory
-- OR --
Inorder to decrypt with the name of virtual directory
aspnet_regiis.exe -pd section -app virtual_directory

Example:
aspnet_regiis.exe -pdf "connectionStrings" "D:\Publish\MyProject\1"
-- OR --
aspnet_regiis.exe -pd "connectionStrings" -app "/MySite"
*Note: No provider is required for decryption as it will pick from webconfig file itself

Happy Dotnetting!~




Monday, April 5, 2010

Multirow Tab Container in Ajax Control Toolkit

I had an issue with Tab Container of Ajax Control toolkit, that i wanted to show mulitple rows as i had number of panels on my page. As making them display in one row was increasing my page width. Let me share a solution i found for this.

After openeing the AJAX Control tool kit solution, go to Tabs.css under AjaxControlToolkit/Tabs/

either comment this line
.ajax__tab_default .ajax__tab_header {white-space:nowrap;}
or change it to
.ajax__tab_default .ajax__tab_header {}

Rebuild the site, and update the reference of AjaxToolkit in your project to the new one. You should see 2 rows like this