Solved

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

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Technology Resume 7 88
Calculating percentage 2 49
Multi-Column Repeater 3 39
jquery autocomplete forcing the user to select an item from the list 7 63
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…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

752 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