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

Wednesday, October 21, 2009

UpdatePanel could not be set on property ContentTemplate

After restarting my system during work on ASP.NET i found popup indicating 'UpdatePanel could not be set on property ContentTemplate' on design view of same pages which were running smoothly before system boot.


After some googling and other searches here's how i fixed my problem:


1. Close all the pages in visual studio and exit VS environment entirely.
2. Open C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files and delete your [Application Name] folder.
3. Restart VS


I did not require to restart IIS, but it can be a useful step for this fix too. This problem may occur in both VS 2005 and VS2008.