asp.net - Retrieving the Windows username from a logged-in machine through an intranet application -


How to make an application, running on a production server , accessing the machine's login username Can a user log in from an app? For example, I am currently logged in to my machine at Intra corporate intranet. My username will be INTRA

I have a database Specific user name and restrict access to an application to check this intranet user name against the database and take advantage of usernames throughout the application.

Currently, I use the following code for the user name:

  String = Thread as the Private Username. Current Principal. Identity .name  

This is working very well on the local host, but while authenticating against the database on a development server , I get the following error:

User 'NT AUTHORITY \ ANONYMOUS LOGON' login failed for user.

Is this a wrong approach? Is this also possible, or is it a lot of security problem? This app will be an internal intranet application running in an IE store. Web already exists. The relevant pieces of config include:

  & lt; Identification impersonation = "true" /> & lt; Authentication mode = "Windows" /> & Lt; Authority & gt; & Lt; Deny users = "?" / & Gt; & Lt; / Authorization & gt; & Lt; ConnectionStrings & gt; & Lt; Name = "CONNSTR" connection string = "initial catalog = DATANAME; data source = servername; integrated security = true;" ProviderName = "System.Data.SqlClient" /> & Lt; / ConnectionStrings & gt;  

When setting up your web application on the server, you need to go to the document Security section (This name changes how the version of your server's IIS is running, but this is something), Turn off anonymous authentication, and turn on Windows authentication. This tells the server to request window login authentication from the browser. (There is probably someone who files me better than web.config [which is almost anyone] can edit it to point to the relevant bit; I do not think it would be Impersonation is but if I knew it, I would say that I have done this by means of UI.)


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -