Monday 12 August 2013

Encript Web.config file using asp.net c#

Step-1 -Run VS as administrator
   
protected void btn_encriptConfig_Click(object sender, EventArgs e)
    {      
        Encryption(true);
    }

    protected void Encryption(bool EncryptoValue)
    {

        Configuration config =WebConfigurationManager.OpenWebConfiguration("~");
        ConfigurationSection sec = config.GetSection("connectionStrings");
        if (EncryptoValue == true)
        {
            sec.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
        }
        else
        {
            sec.SectionInformation.UnprotectSection();
        }
        config.Save();
    }

No comments:

Post a Comment

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...