you don't show the code you use to get the name, or what authentication your site is using. you should also specify if asp.net core or old framework.
How to get user profile for your machine when application hosted on iis using asp.net mvc ?
I work on asp.net MVC application . suppose my user name of my pc is Michel
so i need to rerun this name Michel when application hosted on iis
so i can insert this name with every transaction done and which user insert transactions
i face issue on that it always return name of application on iis hosted app
so how to solve that please
Windows development | Internet Information Services
Developer technologies | ASP.NET | Other
3 answers
Sort by: Most helpful
-
Bruce (SqlWork.com) 78,311 Reputation points Volunteer Moderator
2023-12-18T23:47:16.1533333+00:00 -
AgaveJoe 30,126 Reputation points
2023-12-19T10:57:52.9466667+00:00 This is similar to another one of your recent questions that asks how to get the user's computer name. Getting the user's system login username only works if all the computers are on an Intranet (internal network) and the network uses Windows Authentication. Then you can enable Windows Authentication in IIS to get the user's username.
Authenticating Users with Windows Authentication (C#)
If you are not building an Internet application then use a standard Authentication/Authorization framework like Identity to cache the user name in an authentication cookie. Use the "Individual Account" when creating a new web application in Visual Studio for example code.
Introduction to ASP.NET Identity
You tagged your post as ASP.NET. If you are building an ASP.NET Core application, then read the docs for Core.