Hayadi's Blog

lundi, avril 03, 2006

Cryptage des Sections Web.config sous Asp.net 2.0

Parmi les nouvelles possibilités que la version 2.0 d''asp.net la possibilité d''effectué un cryptage des sections Web.config pour empecher tte lecture Ex de section : ConnectionStrings

Avant le cryptage





Pour ce faire, il suffit de taper la commande suivante automatiquement:

aspnet_regiis -pe "connectionStrings" -app "/SampleApplication"

Autre methode, la programmation :

Configuration config = Configuration.GetWebConfiguration(Request.ApplicationPath);
ConfigurationSection section = config.Sections["connectionStrings"]; section.ProtectSection ("DataProtectionConfigurationProvider");
config.Update();

Aprés cryptage, les sections deviennent :




AQAAANCMndjHoAw...


Pour plus d'infos : http://www.dotnet-maroc.com/ArticlesReader.aspx?ID=155