Le mie pagine Web sono su server protetto (https) e sto tentando di connettere il database di SQL Server 2008, che è un normale server. Sto scrivendo connectiontring sulla pagina stessa, non nel file web.config. E sto ottenendo seguente errore: -Accesso fallito. Il login proviene da un dominio non attendibile e non può essere utilizzato con l'autenticazione di Windows
System.Data.SqlClient.SqlException: Login failed.
The login is from an untrusted domain and cannot be used with Windows authentication.
prega di aiuto, come posso collegarlo, fa ho da fare alcune webservices per esso.
il mio codice è il seguente:
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();
}
DataSet dset = new DataSet();
da.Fill(dset);
if (dset.Tables[0].Rows.Count > 0)
{
drpCity.DataSource = dset;
drpCity.DataTextField = "CityName";
drpCity.DataValueField = "CityName";
drpCity.DataBind();
}
drpCity.Items.Insert(0, new ListItem("--Select--", "0"));
con.Close();
}
Mostraci il tuo codice ed eventualmente un estratto dal tuo file web.config (autenticazione). –