Wednesday, January 22, 2014

CONNECTION STRING


Encript Connection String

SqlConnectionStringBuilder c = new SqlConnectionStringBuilder();
c.ConnectTimeout = 15;
 c.DataSource = @"JANZ-PC\SQLEXPRESS";
c.InitialCatalog = "TEST119KEPPI";
c.IntegratedSecurity = true;
c.Encrypt = true; 
c.TrustServerCertificate = true;
 SqlConnection conn = new SqlConnection (c.ConnectionString);
 conn.Open();
 MessageBox.Show(text: "success");

Encript Connection String Web.Config

using System.Configuration;
using System.Web.Configuration;

Configuration config = WebConfigurationManager.OpenWebConfiguration("~/Security");
        ConnectionStringsSection connStr = (ConnectionStringsSection)config.GetSection("connectionStrings");
        connStr.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");

        config.Save();

No comments:

Post a Comment

Sql server row level policy