select * from Databasename1.dbo.tblEmployees t1
inner join OPENDATASOURCE('SQLOLEDB','Data Source=databasename;User ID=sa;Password=123').Databasename2.dbo.leave t2 on t1.Id = t2.Id
Wednesday, December 30, 2009
Monday, December 21, 2009
Encrypting Connection Strings in web.config file using Code
//Runthis method in page load
public void EncryptConnString()
{
Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
ConfigurationSection section = config.GetSection("connectionStrings");
if (section.SectionInformation.IsProtected)
{
//To Encript
section.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider");
config.Save();
//To Decript
//section.SectionInformation.UnprotectSection();
//config.Save();
}
}
public void EncryptConnString()
{
Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
ConfigurationSection section = config.GetSection("connectionStrings");
if (section.SectionInformation.IsProtected)
{
//To Encript
section.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider");
config.Save();
//To Decript
//section.SectionInformation.UnprotectSection();
//config.Save();
}
}
Subscribe to:
Posts (Atom)