I am having major trouble setting up up a database for an intranet web application. The users get the following errors:
[SqlException (0x80131904): Login failed for user 'XXX\YYYY'.]
A few of the users that have admin rights to the server are able to get on. The other users cannot.
We have IIS set up to use Windows Authentication because the application needs to pass the user's Windows login to the application.
I am basically doing what this user is doing in the following Stack Overflow question: How to get Windows user name when identity impersonate=“true” in asp.net?
I have added some images of the set up to better explain what it is I am trying to do:
The users are different users. We are not using Active Directory. The reason we went with this approach was so that we would not have to manage users accounts, as this tool is self-service.
When I set up IIS to use Anonymous Authentication and ASP.NET impersonation, the application works with the user we have in the Identity and the Application Pool settings. At that point all the users see that user id and the application works. This is not what we need to have happen. The tool needs to work for the user that access the site.
Basically any user on our network can pull up this site and use it (that's the goal at least). If they are logged into a PC on the network they browse to the site and the site picks up their id using the line of code:
var CurrentUser = System.Environment.UserName;
We pass that user's PC ID to a function that searches the database.
For example, I can access the tool on the web server through my IE browser. Other people with admin rights like mine can also get to the app on the web server. The General user can browse to the site and run anything that does not require access to the database, but as soon as they enter a page that uses the database to get data they get the SQL error.
The SQL Server database is on the same Windows Server as the web app run with IIS. They are both on virtual machines that are not here at this site, but I have admin rights to them.