Connect database
[C #]
SqlConnection nwindconn = new SqlConnection ("data source = localhost; integrated security = sspi; initial catalog = northwind");
nwindconn.open ();
Configure web.config files
In the application profile (web.config), you can establish the authentication mode used by the application, and establish an application to simulate user credentials (ie the application will run as this user's identity) mode?
Configure web.config to allow Windows integration security
Open the application's web.config file and add the following elements to it:
Note that the elements in Web.config are case sensitive.
Create a connection string
When you create a connection string to access SQL Server, you must include informing the SQL Server you are using the properties of Windows integration security.
Configure connection string for Windows integration security
In any connection string of SQL Server, contain the property trusted_connection = yes and remove the username and password properties.
The following shows a typical connection string for Windows integration security configuration:
"Workstation ID = WebServer1; packet size = 4096;
Trusted_connection = yes; data source = mysqlservers;
Persist security info = false; initial catalog = northwind