Solved

Error in ASP.NET 2.0 Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection

Posted on 2007-11-14
11
495 Views
Last Modified: 2013-11-07
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.
0
Comment
Question by:edi77
  • 7
  • 4
11 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
what is the connection string you use?
0
 

Author Comment

by:edi77
Comment Utility
connection info:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="KitID"
            DataSourceID="SqlDataSource1">
            <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:TestADNIConnectionString %>"
            SelectCommand="SELECT [KitID], [KitNumber] FROM [FromLabKitsTable]"></asp:SqlDataSource>
also web config:

<configuration>
      <appSettings/>
      <connectionStrings>
  <add name="TestADNIConnectionString" connectionString="Data Source=IN-MMGE-HLOWRLD;Initial Catalog=TestADNI;Integrated 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-admins"/>
                  <allow roles="ADS\In-mmge-hd-users"/>
                  
                  <deny users="*"/>
                  
            </authorization>
            <!--
0
 

Author Comment

by:edi77
Comment Utility
hello anyone out there to help?
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
did you define the windows accounts of the users and the asp account in your sql server?
0
 

Author Comment

by:edi77
Comment Utility
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.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:edi77
Comment Utility
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...
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
>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) ..
0
 

Author Comment

by:edi77
Comment Utility
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?
0
 

Author Comment

by:edi77
Comment Utility
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?
0
 

Author Comment

by:edi77
Comment Utility
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.




0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
Comment Utility
you might want to read through this blog:
http://blogs.msdn.com/sql_protocols/archive/2005/09/28/474698.aspx
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now