edi77
asked on
Error in ASP.NET 2.0 Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection
I am running a linked server using windows authentication. WHen I run a query against the linked server it runs fine. However when I try to connect that to my ASP page and run that query i get an error. Everything else in the ASP site linked to this database runs fine, just not the linked server based query. I am getting the following error. I have impersenation set to true in my web.config as well.
This is ASP.NET 2.0, SQL 2005 linked to a SQL 2000 instance and Windows Authentication.
Here is my errors: any help?
TCP Provider: An existing connection was forcibly closed by the remote host.
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
This is ASP.NET 2.0, SQL 2005 linked to a SQL 2000 instance and Windows Authentication.
Here is my errors: any help?
TCP Provider: An existing connection was forcibly closed by the remote host.
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
what is the connection string you use?
ASKER
connection info:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False " DataKeyNames="KitID"
DataSourceID="SqlDataSourc e1">
<Columns>
<asp:BoundField DataField="KitID" HeaderText="KitID" ReadOnly="True" SortExpression="KitID" />
<asp:BoundField DataField="KitNumber" HeaderText="KitNumber" SortExpression="KitNumber" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TestADNI Connection String %>"
SelectCommand="SELECT [KitID], [KitNumber] FROM [FromLabKitsTable]"></asp: SqlDataSou rce>
also web config:
<configuration>
<appSettings/>
<connectionStrings>
<add name="TestADNIConnectionSt ring" connectionString="Data Source=IN-MMGE-HLOWRLD;Ini tial Catalog=TestADNI;Integrate d Security=True"
providerName="System.Data. SqlClient" />
</connectionStrings>
<system.web>
<roleManager enabled="false" />
<identity impersonate="true"/>
<customErrors mode="Off"/>
<compilation debug="true"/>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<authorization>
<allow roles="ADS\In-mmge-hd-admi ns"/>
<allow roles="ADS\In-mmge-hd-user s"/>
<deny users="*"/>
</authorization>
<!--
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False
DataSourceID="SqlDataSourc
<Columns>
<asp:BoundField DataField="KitID" HeaderText="KitID" ReadOnly="True" SortExpression="KitID" />
<asp:BoundField DataField="KitNumber" HeaderText="KitNumber" SortExpression="KitNumber"
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TestADNI
SelectCommand="SELECT [KitID], [KitNumber] FROM [FromLabKitsTable]"></asp:
also web config:
<configuration>
<appSettings/>
<connectionStrings>
<add name="TestADNIConnectionSt
providerName="System.Data.
</connectionStrings>
<system.web>
<roleManager enabled="false" />
<identity impersonate="true"/>
<customErrors mode="Off"/>
<compilation debug="true"/>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<authorization>
<allow roles="ADS\In-mmge-hd-admi
<allow roles="ADS\In-mmge-hd-user
<deny users="*"/>
</authorization>
<!--
ASKER
hello anyone out there to help?
did you define the windows accounts of the users and the asp account in your sql server?
ASKER
i probably didn't? what do i need to do? my first time at all this. would you be able to give me some direction. that might be it.
ASKER
in the linked server? or the main sql server? any asp page i hit from the main sql server works fine. its just the linked part that doesnt. i tested the linked server connections under my user id (using windows auth for everything)
so i thought it should work at least as me but it doesnt...
so i thought it should work at least as me but it doesnt...
>or the main sql server?
yes, in the main sql server. open the security folder, logins, and create there the logins based on the windows accounts used (or the windows groups those users are member of).
than, grant that login the permissions in the database(s) ..
yes, in the main sql server. open the security folder, logins, and create there the logins based on the windows accounts used (or the windows groups those users are member of).
than, grant that login the permissions in the database(s) ..
ASKER
ok so i went into SQL under security i added a user login that is in my users group in ads.
then i made the db im using their defualt db.
is this what you mean or do they need something else?
now what are you saying about adding the asp account to my sql server?
then i made the db im using their defualt db.
is this what you mean or do they need something else?
now what are you saying about adding the asp account to my sql server?
ASKER
ok so after adding that user to sql i am getting this error now....
seems better
Cannot open database "TestADNI" requested by the login. The login failed.
Login failed for user 'ADS\mmgehg'
this user can login into any other page that accesses the db just not this one, because this one is the linked server one. any idea what to do next?
seems better
Cannot open database "TestADNI" requested by the login. The login failed.
Login failed for user 'ADS\mmgehg'
this user can login into any other page that accesses the db just not this one, because this one is the linked server one. any idea what to do next?
ASKER
so i just noticed when I login as ME -im the admin ---i get the null error
TCP Provider: An existing connection was forcibly closed by the remote host.
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
when i login as this new user i created on sql i get the
Cannot open database "TestADNI" requested by the login. The login failed.
Login failed for user 'ADS\mmgehg'
my default db is master, mmgehg's the specific testadni db it needs.
TCP Provider: An existing connection was forcibly closed by the remote host.
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
when i login as this new user i created on sql i get the
Cannot open database "TestADNI" requested by the login. The login failed.
Login failed for user 'ADS\mmgehg'
my default db is master, mmgehg's the specific testadni db it needs.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.