Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (6.1k points)

I am working on a website, where I use windows authentication in the database.

I suppose that you use the following for SQL authentication:

<connectionStrings> 

    <add name="NorthwindContex" 

       connectionString="data source=localhost;

       initial catalog=northwind;persist security info=True; 

       user id=sa;password=P@ssw0rd" 

       providerName="System.Data.SqlClient" /> 

</connectionStrings>

What is the way to modify this to work with windows authentication?

1 Answer

0 votes
by (11.7k points)

In SQL, It is very easy to establish a connection string. 

Actually, you need to replace the username and password with Integrated Security=SSPI;

Therefore the connection string should be:

<connectionStrings> 

<add name="NorthwindContex" 

   connectionString="data source=localhost;

   initial catalog=northwind;persist security info=True; 

   Integrated Security=SSPI;" 

   providerName="System.Data.SqlClient" /> 

</connectionStrings> 

Related questions

0 votes
1 answer
0 votes
4 answers
0 votes
0 answers
0 votes
1 answer

Browse Categories

...