Are you interested in Data Engineering Essentials course on Kontext? Learn more
Get IP Address in ASP.NET Core 5
visibility 10,943
comment 2
This page summarize information about how to retrieve client and server IP address in ASP.NET Core 5 (.NET 5) web applications. This page is an updated version of Get IP Address in ASP.NET Core 3.x . Client IP address can be retrieved via HttpContext.Connection object. This properties ...
thumb_up 2
Log in with external accounts
comment Comments
9 months ago
link
more_vert
U
Udaysinh
web_assetArticles 0
imageDiagrams 0
forumThreads 0
commentComments 1
loyaltyKontext Points 1
#1505 Re: Get IP Address in ASP.NET Core 5
Very useful article . Thanks. but
How can get client System name and client local machine user name?
#1506 Re: Get IP Address in ASP.NET Core 5
For user OS system type, you can use User-Agent in request headers:
For example the above value means Windows 10 x64 edition.
As there are many browsers and many system types and versions, it is not easy to do a holistic parsing. What you can do is to find out the most useful ones for you based on each browser User-Agent definitions.
For client local user machine name, it is not sent to the server in the request unless you are using Windows Authentication. Even for this authentication type, it doesn't necessarily represent the actual user name as user can use Run As to impersonate users.
Configure Windows Authentication in ASP.NET Core | Microsoft Docs
And then you can use the following approach in Razor Pages or Controllers to get user name:
person Udaysinh access_time 9 months ago
Re: Get IP Address in ASP.NET Core 5
Very useful article . Thanks. but
How can get client System name and client local machine user name?