Hi!!!
1. for this you want to firstly encrypt your web.config file text!!!
/*-------------------------------------------------------------------------------------*/
/*Encription of Web.Config*/
/*
private void EncryptAppSettings()
{
Configuration objConfig =
WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
AppSettingsSection objAppsettings =
(AppSettingsSection)objConfig.GetSection("appSettings");
if (!objAppsettings.SectionInformation.IsProtected)
{
objAppsettings.SectionInformation.ProtectSection(
"RsaProtectedConfigurationProvider");
objAppsettings.SectionInformation.ForceSave = true;
objConfig.Save(ConfigurationSaveMode.Modified);
}
}
/*Decription of Web.Config*//*
private void DecryptAppSettings()
{
Configuration objConfig =
WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
AppSettingsSection objAppsettings =
(AppSettingsSection)objConfig.GetSection("appSettings");
if (objAppsettings.SectionInformation.IsProtected)
{
objAppsettings.SectionInformation.UnprotectSection();
objAppsettings.SectionInformation.ForceSave = true;
objConfig.Save(ConfigurationSaveMode.Modified);
}
}
/*-------------------------------------------------------------------------------------*/
[Edit]
2. (Added from another answer box)
visit article on this link!!!
Encrypt and Decrypt Text with a Specified Key[
^]
from this link you are able to encrypt the text!!
and i m giving u a function to decrypt the text use on class file and call on the function when u need
public static string DecValue(string cipherText)
{
if (ConfigurationManager.AppSettings["Encr"] != "1")
{
return cipherText;
}
else
{
Crypto1 a = new Crypto1();
return a.DecryptStringAES(cipherText, "o7x8y6");
}
}
}
[/Edit]