1
Answer

How to add encryption key automatically in MS Enterprise Library

Photo of Mazen Al qarawi

Mazen Al qarawi

14y
7.2k
1

I'm a team member in developing an enterprise application that will be generating packages to submit to the enterprise contractors to install it at their PC.

One of my tasks is to add encryption to the application's fields. this was accomplished by add encryption key to app.config file and the key was generated by MS Enterprise Library manager.

In the above step I have to go to the manager application and create the key then copy it and paste it to the application config file. This is valid to be done in the current machine but once we created a setup project and generated a package and send it to the contractor, this step has to be done manually and at the contractor site.

Is there a way to generate the key and add it to the application config file automatically on the application setup or at package generation?

I hope that my case is clear and I need your help guys as I already tried to resolve this issue and the task due date is next week and I don't want to delay it.

Thanks in advance for everyone who is going to help.

Answers (1)

0
Photo of Pravin More
NA 2.6k 136.1k 13y
Hi Symesh,

Set in your connection string IP address of remote server. E.g.
"Data source=112.160.0.18; Database=dbname;User ID=urusername;password=****"
where 192.168.0.13 is your remote server IP and MyDb is your database name.
Also, make sure to configure your SQL Server Express to allow remote connections! Those are disabled by default after installation.

Thanks,
Pravin.
Accepted
2
Photo of Datta Kharad
NA 2.5k 40.9k 13y
Hi

 
   string connectionstring ="data source=[Servername];initial catalog=Northwind; integrated security=SSPI;persist security info=False; Trusted_Connection=Yes."

Where datasource will be computer name or IP Address, and initial catalog is the name of database.
       For Windows Aunthetication you can use either MyDbConn1 or MyDbConn2:-
In web.config file...

<connectionStrings>
<add name="MyDbConn1"
connectionString="Server=MyServer;Database=MyDb;Trusted_Connection=Yes;"/>
<add name="MyDbConn2"
connectionString="Initial Catalog=MyDb;Data Source=MyServer;Integrated Security=SSPI;"/>
</connectionStrings>

      // Retrieving connection string from Web.config.
 String connString = WebConfigurationManager.ConnectionStrings["MyDbConn1"].ToString();
  SqlConnection conn = new SqlConnection(connString);
  conn.Open();


Please mark as Accepted answer if your query resolved.  
0
Photo of Prabhu Raja
NA 4.7k 1.5m 13y