使用Windows身份验证连接字符串 [英] Connection string using Windows Authentication

查看:1084
本文介绍了使用Windows身份验证连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个网站,但在数据库中我使用Windows身份验证。

I am creating a website, but in the database I use windows authentication.

我知道,您使用此为SQL身份验证

I know that you use this 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>

我如何修改这个使用Windows身份验证工作?

How do I modify this to work with windows authentication?

推荐答案

替换集成安全性= SSPI的用户名和密码;

因此​​,连接字符串应该是

So 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> 

这篇关于使用Windows身份验证连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆