Trouble authenticating to Remote SQL Server

B

Brent Waldrop

Ok everyone, i have been pulling my hair out on this one. I have been
working on it for 3 days with no sucess. This problem is occuring at home
where i am running a workgroup. I have Windows 2003 Ent Server on one
machine and windows xp sp2 on another. The db server is located on the
Windows 2003 machine. I am working locally with asp.net 1.1 on the xp
workstation and the web server is also locally on the xp workstation. Every
time i try to connect with the asp.net application to the database i get the
following error:

Server Error in '/WebApplication1' Application.
----------------------------------------------------------------------------
----

Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for user
'(null)'. Reason: Not associated with a trusted SQL Server connection.

Source Error:


Line 44:
Line 45: ' fill the dataset
Line 46: dataAdapter.Fill(ds, "Customers")
Line 47: Dim bldr As New SqlCommandBuilder(dataAdapter)
Line 48:


Source File: c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.vb Line: 46

Stack Trace:


[SqlException: Login failed for user '(null)'. Reason: Not associated with a
trusted SQL Server connection.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)

System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnec
tionString options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState)
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord,
Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior
behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
WebApplication1.WebForm1.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.vb:46
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()


I have tried to following to fix the problem.

1) Tried to add the asp.net user to sql server

2) Removed tcp/ip from the connect types to sql server

3) added a new user which i called "aspnetuser" to both computers then when
into anonymous logins on IIS and added this user as the anonymous login user
and unchecked the let IIS control the password and typed in the correct
password.

4) change the asp.net user that the install of vs.net added and added them
to the admin group on both machines. I have no problem login into sql server
(windows authentication) when i use my local account i created on the xp
workstation for me (im in the admin group).

The only thing i have not used is impersonation and id rather not unless i
have to. Course since i haven't tried it, i might have trouble with it too.

Scratch what i just said above. I tried impersonaltion and it worked but id
rather not use this if at all possible. I want to use the security that
vs.net set up for the "asp.net" user. Is this possible without using
impersonation?

Thanks,
Brent
 
R

Rob Bazinet

What does your connection string look like? If you are on a workgroup and
NOT in a domain your sql server is not going to know the requesting user.

Have you tried not using a trusted connection and use something like this in
your connection string:

Server=(local);Initial Catalog=pubs;User Id=sa;Password=

-Rob

Brent Waldrop said:
Ok everyone, i have been pulling my hair out on this one. I have been
working on it for 3 days with no sucess. This problem is occuring at home
where i am running a workgroup. I have Windows 2003 Ent Server on one
machine and windows xp sp2 on another. The db server is located on the
Windows 2003 machine. I am working locally with asp.net 1.1 on the xp
workstation and the web server is also locally on the xp workstation.
Every
time i try to connect with the asp.net application to the database i get
the
following error:

Server Error in '/WebApplication1' Application.
----------------------------------------------------------------------------
----

Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for
user
'(null)'. Reason: Not associated with a trusted SQL Server connection.

Source Error:


Line 44:
Line 45: ' fill the dataset
Line 46: dataAdapter.Fill(ds, "Customers")
Line 47: Dim bldr As New SqlCommandBuilder(dataAdapter)
Line 48:


Source File: c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.vb Line:
46

Stack Trace:


[SqlException: Login failed for user '(null)'. Reason: Not associated with
a
trusted SQL Server connection.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)

System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnec
tionString options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState)
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord,
Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior
behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
WebApplication1.WebForm1.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.vb:46
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()


I have tried to following to fix the problem.

1) Tried to add the asp.net user to sql server

2) Removed tcp/ip from the connect types to sql server

3) added a new user which i called "aspnetuser" to both computers then
when
into anonymous logins on IIS and added this user as the anonymous login
user
and unchecked the let IIS control the password and typed in the correct
password.

4) change the asp.net user that the install of vs.net added and added them
to the admin group on both machines. I have no problem login into sql
server
(windows authentication) when i use my local account i created on the xp
workstation for me (im in the admin group).

The only thing i have not used is impersonation and id rather not unless i
have to. Course since i haven't tried it, i might have trouble with it
too.

Scratch what i just said above. I tried impersonaltion and it worked but
id
rather not use this if at all possible. I want to use the security that
vs.net set up for the "asp.net" user. Is this possible without using
impersonation?

Thanks,
Brent
 
B

Brent Waldrop

Actually Rob, SQL Server does. I created two identical user accounts on both
the xp box and the windows 2003 box and used the same password. I can log
into query analyzer just fine using windows authentication. My sql server is
set up to use only windows authentication so username/password does not work
and i prefer to keep it this way. Also the server explorer works just fine
under the VS.Net IDE. I appreciate your reply though. Also when i create a
regular vb.net app; windows authentication works just fine.

Brent
Rob Bazinet said:
What does your connection string look like? If you are on a workgroup and
NOT in a domain your sql server is not going to know the requesting user.

Have you tried not using a trusted connection and use something like this in
your connection string:

Server=(local);Initial Catalog=pubs;User Id=sa;Password=

-Rob

Brent Waldrop said:
Ok everyone, i have been pulling my hair out on this one. I have been
working on it for 3 days with no sucess. This problem is occuring at home
where i am running a workgroup. I have Windows 2003 Ent Server on one
machine and windows xp sp2 on another. The db server is located on the
Windows 2003 machine. I am working locally with asp.net 1.1 on the xp
workstation and the web server is also locally on the xp workstation.
Every
time i try to connect with the asp.net application to the database i get
the
following error:

Server Error in '/WebApplication1' Application.
--------------------------------------------------------------------------
--
----

Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for
user
'(null)'. Reason: Not associated with a trusted SQL Server connection.

Source Error:


Line 44:
Line 45: ' fill the dataset
Line 46: dataAdapter.Fill(ds, "Customers")
Line 47: Dim bldr As New SqlCommandBuilder(dataAdapter)
Line 48:


Source File: c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.vb Line:
46

Stack Trace:


[SqlException: Login failed for user '(null)'. Reason: Not associated with
a
trusted SQL Server connection.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)

System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnec
tionString options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState)
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord,
Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior
behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
WebApplication1.WebForm1.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.vb:46
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()


I have tried to following to fix the problem.

1) Tried to add the asp.net user to sql server

2) Removed tcp/ip from the connect types to sql server

3) added a new user which i called "aspnetuser" to both computers then
when
into anonymous logins on IIS and added this user as the anonymous login
user
and unchecked the let IIS control the password and typed in the correct
password.

4) change the asp.net user that the install of vs.net added and added them
to the admin group on both machines. I have no problem login into sql
server
(windows authentication) when i use my local account i created on the xp
workstation for me (im in the admin group).

The only thing i have not used is impersonation and id rather not unless i
have to. Course since i haven't tried it, i might have trouble with it
too.

Scratch what i just said above. I tried impersonaltion and it worked but
id
rather not use this if at all possible. I want to use the security that
vs.net set up for the "asp.net" user. Is this possible without using
impersonation?

Thanks,
Brent
 
E

EC

In this case, you need to add the IIS_WPG account to your database users.

Brent Waldrop said:
Actually Rob, SQL Server does. I created two identical user accounts on both
the xp box and the windows 2003 box and used the same password. I can log
into query analyzer just fine using windows authentication. My sql server is
set up to use only windows authentication so username/password does not work
and i prefer to keep it this way. Also the server explorer works just fine
under the VS.Net IDE. I appreciate your reply though. Also when i create a
regular vb.net app; windows authentication works just fine.

Brent
Rob Bazinet said:
What does your connection string look like? If you are on a workgroup and
NOT in a domain your sql server is not going to know the requesting user.

Have you tried not using a trusted connection and use something like this in
your connection string:

Server=(local);Initial Catalog=pubs;User Id=sa;Password=

-Rob

Brent Waldrop said:
Ok everyone, i have been pulling my hair out on this one. I have been
working on it for 3 days with no sucess. This problem is occuring at home
where i am running a workgroup. I have Windows 2003 Ent Server on one
machine and windows xp sp2 on another. The db server is located on the
Windows 2003 machine. I am working locally with asp.net 1.1 on the xp
workstation and the web server is also locally on the xp workstation.
Every
time i try to connect with the asp.net application to the database i get
the
following error:

Server Error in '/WebApplication1' Application.
--------------------------------------------------------------------------
--
----

Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for
user
'(null)'. Reason: Not associated with a trusted SQL Server connection.

Source Error:


Line 44:
Line 45: ' fill the dataset
Line 46: dataAdapter.Fill(ds, "Customers")
Line 47: Dim bldr As New SqlCommandBuilder(dataAdapter)
Line 48:


Source File: c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.vb Line:
46

Stack Trace:


[SqlException: Login failed for user '(null)'. Reason: Not associated with
a
trusted SQL Server connection.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)

System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnec
tionString options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState)
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord,
Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior
behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
WebApplication1.WebForm1.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.vb:46
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()


I have tried to following to fix the problem.

1) Tried to add the asp.net user to sql server

2) Removed tcp/ip from the connect types to sql server

3) added a new user which i called "aspnetuser" to both computers then
when
into anonymous logins on IIS and added this user as the anonymous login
user
and unchecked the let IIS control the password and typed in the correct
password.

4) change the asp.net user that the install of vs.net added and added them
to the admin group on both machines. I have no problem login into sql
server
(windows authentication) when i use my local account i created on the xp
workstation for me (im in the admin group).

The only thing i have not used is impersonation and id rather not unless i
have to. Course since i haven't tried it, i might have trouble with it
too.

Scratch what i just said above. I tried impersonaltion and it worked but
id
rather not use this if at all possible. I want to use the security that
vs.net set up for the "asp.net" user. Is this possible without using
impersonation?

Thanks,
Brent
 
B

brent

Just tried that...that doesn't work either.

EC said:
In this case, you need to add the IIS_WPG account to your database users.

Brent Waldrop said:
Actually Rob, SQL Server does. I created two identical user accounts on
both
the xp box and the windows 2003 box and used the same password. I can log
into query analyzer just fine using windows authentication. My sql server
is
set up to use only windows authentication so username/password does not
work
and i prefer to keep it this way. Also the server explorer works just
fine
under the VS.Net IDE. I appreciate your reply though. Also when i create
a
regular vb.net app; windows authentication works just fine.

Brent
Rob Bazinet said:
What does your connection string look like? If you are on a workgroup
and
NOT in a domain your sql server is not going to know the requesting
user.

Have you tried not using a trusted connection and use something like
this in
your connection string:

Server=(local);Initial Catalog=pubs;User Id=sa;Password=

-Rob

Ok everyone, i have been pulling my hair out on this one. I have been
working on it for 3 days with no sucess. This problem is occuring at home
where i am running a workgroup. I have Windows 2003 Ent Server on
one
machine and windows xp sp2 on another. The db server is located on
the
Windows 2003 machine. I am working locally with asp.net 1.1 on the xp
workstation and the web server is also locally on the xp workstation.
Every
time i try to connect with the asp.net application to the database i
get
the
following error:

Server Error in '/WebApplication1' Application.

-------------------------------------------------------------------------- --
----

Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
Description: An unhandled exception occurred during the execution of
the
current web request. Please review the stack trace for more
information
about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed
for
user
'(null)'. Reason: Not associated with a trusted SQL Server
connection.

Source Error:


Line 44:
Line 45: ' fill the dataset
Line 46: dataAdapter.Fill(ds, "Customers")
Line 47: Dim bldr As New SqlCommandBuilder(dataAdapter)
Line 48:


Source File: c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.vb Line:
46

Stack Trace:


[SqlException: Login failed for user '(null)'. Reason: Not associated with
a
trusted SQL Server connection.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)

System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnec
tionString options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection
connection,
ConnectionState& originalState)
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord,
Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior
behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
WebApplication1.WebForm1.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.vb:46
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()


I have tried to following to fix the problem.

1) Tried to add the asp.net user to sql server

2) Removed tcp/ip from the connect types to sql server

3) added a new user which i called "aspnetuser" to both computers
then
when
into anonymous logins on IIS and added this user as the anonymous
login
user
and unchecked the let IIS control the password and typed in the
correct
password.

4) change the asp.net user that the install of vs.net added and added them
to the admin group on both machines. I have no problem login into sql
server
(windows authentication) when i use my local account i created on the
xp
workstation for me (im in the admin group).

The only thing i have not used is impersonation and id rather not
unless i
have to. Course since i haven't tried it, i might have trouble with
it
too.

Scratch what i just said above. I tried impersonaltion and it worked
but
id
rather not use this if at all possible. I want to use the security
that
vs.net set up for the "asp.net" user. Is this possible without using
impersonation?

Thanks,
Brent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top