djozy,
The reason this is failing is that you are using the Trusted_Connection
property, which means that it will ignore the user id and password fields.
If you have a specific account to login, remove the Trusted_Connection
property and then place the user name and password there.
The problem arises because ASP.NET (which you are running this in), runs
under the ASPNET user account by default. This account has very limited
permissions. So, to get around that, you either have to change the user
that the page runs under (through the web.config file for the directory), or
elevating the privledges of the ASP.NET user.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"djozy" <an*******@discussions.microsoft.com> wrote in message
news:04****************************@phx.gbl...
I want to make asp.net application in C# that is connected
with SQL Server database. When I put this connection
string:
SqlConnection conn = new SqlConnection(
"user id=;" +
"password=;server=localhost;" +
"Trusted_Connection=yes;"+
"database=Knjiznica;" +
"connection timeout=30");
try
{
conn.open();
}
catch(SqlException sqle)
{
this.TextBox1 .Text =sqle.Message ;
}
it throws me this error in textbox1: Login failed for
user 'JOSIP-SKY2IGFE7\ASPNET'. where JOSIP-SKY2IGFE7 is
name of my computer.
When I make windows application and put the same
connection string it works!!
What do I need to do that my web applications also works?
Thank you