Solved

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

Posted on 2006-06-09
5
360 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 125 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
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.…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

626 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