Follow by Email

Friday, March 28, 2014

encrypt decrypt webconfig connectionStrings from codebehind in | Secure web config Connection Strings with RSACryptoServiceProvider Class through coding in

hi in this post i will show how to secure connection strings inside a web.config file from code in

1. code to encrypt :

      protected void Encrypt_Click(object sender, EventArgs e)
        string provider = "RSAProtectedConfigurationProvider";
        string section = "connectionStrings";
        Configuration confg = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
        ConfigurationSection configSect = confg.GetSection(section);
        if (configSect != null)


2. code to decrypt :

    protected void Button2_Click(object sender, EventArgs e)
        string section = "connectionStrings";
        Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
        ConfigurationSection configSect = config.GetSection(section);
        if (configSect.SectionInformation.IsProtected)


Using Javascript to create a Datatime picker control in Html

hi in this post lets c how to create a datetime picker in html using Javascript.

1. download the js file using this url.

2. After u download this extract the zip file and after extracting add the .js and image files into your project.

3. Below is the implementation code, you can also get the sample code in the zip file downloaded.

<!DOCTYPE html>

<script language="javascript" type="text/javascript" src="datetimepicker.js">

<input type="Text" id="date1" maxlength="25" size="25">

Select a Date : <a href="javascript:NewCal('date1','ddmmmyyyy',true,24)"><img src="images/cal.gif" width="20" height="18"></a>


4. Output: