相关疑难解决方法(0)

登录失败.登录来自不受信任的域,不能与Windows身份验证一起使用

我的网页在安全服务器(https)上,我正在尝试连接SQL Server 2008数据库,这是普通的服务器.我在页面本身上编写连接字符串,而不是在web.config文件中.我收到以下错误: -

System.Data.SqlClient.SqlException: Login failed.
The login is from an untrusted domain and cannot be used with Windows authentication.
Run Code Online (Sandbox Code Playgroud)

请帮助,如何连接它,我是否必须为它做一些web服务.

我的代码如下:

public void FillCity()
{
    SqlConnection con = new SqlConnection();
    con.ConnectionString = "integrated security=SSPI;data source=dev-fcb; user id=sa;password=password;" 
    +"persist security info=False;database=mediapro";
    con.Open();
    SqlDataAdapter da = new SqlDataAdapter();
    da.SelectCommand = new SqlCommand("select * from StateCityMaster where IsActive='1' order by CityName", con);
    DataSet ds = new DataSet();
    da.Fill(ds);
    string CityName = string.Empty;
    if (ds.Tables[0].Rows.Count > 0)
    {
        CityName = ds.Tables[0].Rows[0]["CityName"].ToString();
    } …
Run Code Online (Sandbox Code Playgroud)

sql https web-services sql-server-2008

11
推荐指数
2
解决办法
6万
查看次数

标签 统计

https ×1

sql ×1

sql-server-2008 ×1

web-services ×1