Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

"Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection."

Posted on 2006-06-09
5
Medium Priority
?
362 Views
Last Modified: 2010-08-05
Hi

Im building an ASP.Net page in VB.Net 2005.
In my solution I have included the web project and a db functions component that handles all database requests.

On load the page instantiates the db functions component and executes a function that retrieves data from the database.

I have set up the default security under IIS to run under a user account that I kbow has dbowner permissions on the databse.

When I run the project I get the error "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection."

how can I set up IIS so the page and the subsequent calls to other components run under the context of the use setup on IIS?

Thank you for any help in this regard.
0
Comment
Question by:vkarumbaiah
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 14

Accepted Solution

by:
existenz2 earned 500 total points
ID: 16870350
It's not a IIS problem, but a connection string/SQL Server problem. Have a look at:

http://geekswithblogs.net/ranganh/archive/2005/05/25/40489.aspx

0
 
LVL 28

Expert Comment

by:strickdd
ID: 16870629
If you want the proper connection string for a trusted connection user go to: www.connectionstrings.com. They list all types of DB connections and the strings to use for each one.
0
 
LVL 3

Expert Comment

by:maidinhtai
ID: 16873411
Go to Directory Sercurity tab (IIS) -> Edit -> Check Integrated Windows authentication
0
 
LVL 1

Author Comment

by:vkarumbaiah
ID: 16879443
Hi maidinhtai

Yes Ive already done that however, it did not solve the problem.
The website runs but I get the same error when the component with the db functions tries to access the database.

I did get it to work and I can continue with development however this is not a pretty solution and definitely not production ready.
What did was, I had to set the Local Impersonation to use an account that has permissions to access the databse in the web.config.
i.e ASP.net tab (IIS) -> Edit Configuration -> ASP.Net Configuration settings -> Application -> Identity Settings -> Local Imersonation

This modifies the web.config file of the asp.net application and adds the following elements to the web.config file
<identity impersonate="true" userName="myusername" password="mypassword" />

This works but I want to find a way to achieve this without having to store the user id and password in a text file.

existenz2 - I am yet to try the suggestion in the article you suggested As the article sugests my production IIS server and sql server are on seperate machines.





0
 
LVL 1

Author Comment

by:vkarumbaiah
ID: 16880905
existenz2

I read the link you posted and Part two of the suggested solution applies to my situation i.e. as below

1. Type inetmgr from your command prompt and give enter.
2. This would open the IIS Control Panel.
3. Expand the appropriate nodes and select the Virtual Directory of your application.
4. Right Click and select Properties.
5. Switch to the Directory Security Tab.
6. Under Anonymous access and authentication control click Edit
7. Check the Enable Anonymous access in case you want people to access the application without logging in with Windows Logon Screen.
8. Uncheck the Allow IIS to control password and enter the DomainName/UserName and Password in the respective boxes. Usually IIS uses IUSER_MACHINENAME credentials for Anonymous access.
9. Uncheck if any other authentication mode is checked and then press Ok twice to exit.
10. Then in web.config you can use either one of these connection strings:

i. "data source=yourservername;initial catalog=databasename;Integrated Security=SSPI"

ii. "server=yourservername; database=databasename;Trusted_Connection=true"


Thank you for your help, that was an excellent resource!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

704 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