kenmck
asked on
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
When I am using NT Security to conect to a sqlserver database from a vb.net form using asp I get the following error:
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
How do I fix this?
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
How do I fix this?
ASKER
<sessionState
mode="InProc"
stateConnectionString="tcp ip=127.0.0 .1:42424"
sqlConnectionString="data source=127.0.0.1;user id=sa;password=lob"
cookieless="false"
timeout="20"
/>
Thanks,
mode="InProc"
stateConnectionString="tcp
sqlConnectionString="data source=127.0.0.1;user id=sa;password=lob"
cookieless="false"
timeout="20"
/>
Thanks,
I do not suggest using the sa user for it. And you have not specified a database.
Change it to the following:
"data source=localhost;integrate d security=sspi;database=you rdatabase"
Now the user account that is being used to access the database is the ASPNET user (remember you are using WinNT security).
So you will need to give that user access to the database within SQL Server.
You know how to do that?
CJ
Change it to the following:
"data source=localhost;integrate
Now the user account that is being used to access the database is the ASPNET user (remember you are using WinNT security).
So you will need to give that user access to the database within SQL Server.
You know how to do that?
CJ
Oh also:
"data source=localhost;integrate d security=sspi;database=you rdatabase; Trusted_Co nnection=y es"
"data source=localhost;integrate
ASKER
I have set up my connection string to the following:
Dim strConn As String = "server=bkrenf;database=di scovery;ui d=sa;pwd=l ob"
and I get connected.
When I use
Dim strConn As String = "server=bkrenf;integrated security=sspi;database=dis covery;Tru sted_Conne ction=yes"
I get an error message "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection".
Any idea why?
Dim strConn As String = "server=bkrenf;database=di
and I get connected.
When I use
Dim strConn As String = "server=bkrenf;integrated security=sspi;database=dis
I get an error message "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection".
Any idea why?
ASKER
I have set up my connection string to the following:
Dim strConn As String = "server=bkrenf;database=di scovery;ui d=sa;pwd=l ob"
and I get connected.
When I use
Dim strConn As String = "server=bkrenf;integrated security=sspi;database=dis covery;Tru sted_Conne ction=yes"
I get an error message "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection".
Any idea why?
Dim strConn As String = "server=bkrenf;database=di
and I get connected.
When I use
Dim strConn As String = "server=bkrenf;integrated security=sspi;database=dis
I get an error message "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection".
Any idea why?
ASKER
I have set up my connection string to the following:
Dim strConn As String = "server=bkrenf;database=di scovery;ui d=sa;pwd=l ob"
and I get connected.
When I use
Dim strConn As String = "server=bkrenf;integrated security=sspi;database=dis covery;Tru sted_Conne ction=yes"
I get an error message "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection".
Any idea why?
Dim strConn As String = "server=bkrenf;database=di
and I get connected.
When I use
Dim strConn As String = "server=bkrenf;integrated security=sspi;database=dis
I get an error message "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection".
Any idea why?
I think because of the integrated security item.
The first error is because you have not provided a default database you want to connect to. I'd still say that the Trusted_Connection property should be in there since it is a trusted connection. And if it is you will encounter an error when you ommit that item.
I have no idea why your first sample works without the Trusted_Connection item. :-/
CJ
The first error is because you have not provided a default database you want to connect to. I'd still say that the Trusted_Connection property should be in there since it is a trusted connection. And if it is you will encounter an error when you ommit that item.
I have no idea why your first sample works without the Trusted_Connection item. :-/
CJ
ASKER
Nope still cannot get this to work. How do I use a Trusted Connection or NT Security to connect?
Have you got any examples?
Have you got any examples?
I used the following:
Provider=sqloledb;initial catalog=MYDATABASE;Trusted _Connectio n=yes;data source=(local);Connect Timeout=20
However, searching for the error you got you get to some pages that explain this error in more detail:
"Trusted_Connection=true;d atabase=MY DATABASE;s erver=(loc al)"
Provider=sqloledb;initial catalog=MYDATABASE;Trusted
However, searching for the error you got you get to some pages that explain this error in more detail:
"Trusted_Connection=true;d
Try setting the impersonation to true in web.config file. By setting it to true, you will be connecting to SQL server under the context of windows login that is logged oonto clinet machine. Otherwise you are connecting as ASPNET account.
<identity impersonate="true">
<identity impersonate="true">
ASKER
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'
is now my error message.
Help!
is now my error message.
Help!
ASKER
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'
is now my error message.
Help!
is now my error message.
Help!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry to barge in on the experts here but here is a sample connection string that I use to asscess from ASP.NET
"server=servername; trusted_connection=false; uid=username; pwd=password; Database=databasename"
The key is that the trusted connection can only be true of the sql server and the app server are the same machine.
Micahel
"server=servername; trusted_connection=false; uid=username; pwd=password; Database=databasename"
The key is that the trusted connection can only be true of the sql server and the app server are the same machine.
Micahel
All you need are some additional items.
CJ