Sunday, June 3, 2018

Geo map

https://tutorialzine.com/2018/05/the-simplest-way-to-add-google-maps

Geomap

https://tutorialzine.com/2018/05/the-simplest-way-to-add-google-maps

Wednesday, May 9, 2012

how to secure web.config file in asp net

In this Article  I will explain  how to Encrypt Decrypt  appsettings/connection string in web.config , Here  i used  RsaProtectedConfigurationProvider 


To Encrypt


        Configuration objConfig = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
        AppSettingsSection objAppsettings = (AppSettingsSection)objConfig.GetSection("appSettings");
        if (!objAppsettings.SectionInformation.IsProtected)
        {
            objAppsettings.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider");
            objAppsettings.SectionInformation.ForceSave = true;
            objConfig.Save(ConfigurationSaveMode.Modified);
        }



 To Descrypt


 Configuration objConfig = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
        AppSettingsSection objAppsettings = (AppSettingsSection)objConfig.GetSection("appSettings");
        if (objAppsettings.SectionInformation.IsProtected)
        {
            objAppsettings.SectionInformation.UnprotectSection();
            objAppsettings.SectionInformation.ForceSave = true;
            objConfig.Save(ConfigurationSaveMode.Modified);
        }


Here you can Replace ("appSettings") by  ("connectionStrings")  if you want to protect connectionStrings
To download Click here . If you have windows 7 run visual studio as administrator.