IP Address

In ASP.NET Core, Request.UserHostAddress has been removed though that attribute exists in the traditional ASP.NET applications.

We can use HttpContext.Connection to retrieve the remove client IP address:

var ipAddress = HttpContext.Connection.RemoteIpAddress?.ToString();

Note

This IP address may not be the direct IP address of the user.  For example, user may use VPN, proxy and etc.

User Agent

Through user agent, we can get users’ browser information.

var userAgent = Request.Headers["User-Agent"];

User Languages

To support localization and globalization, user language is also important. Accept-Language request header can be used for this purpose. However, this attribute is an array and even the element can include multiple languages separated by semi comma. For example, “en-US, en, *”.

var languages = Request.Headers["Accept-Language"];

info Last modified by Raymond at 3 years ago * This page is subject to Site terms.

More from Kontext

Entity Framework Core Code-First - Generate Covering Index with Columns Included

local_offer entity-framework local_offer asp.net core local_offer Azure local_offer C#

visibility 17
thumb_up 0
access_time 7 days ago

In SQL Server or some other relational databases, it is a very common requirement to create covering index with columns included in index pages beside the index key columns. With Entity Framework Core, you can also easily generate covering indexes using purely C# code. Scenario For ...

open_in_new ASP.NET Core

local_offer asp.net core local_offer asp.net core 3

visibility 11
thumb_up 0
access_time 25 days ago

Sign-in with social accounts like Google, Microsoft, Twitter and Facebook accounts are very commonly used in websites to allow website users to logon easily without registering an separate account. Issue summary During the implementation of Kontext Google sign-in function, I encoun...

open_in_new ASP.NET Core

Modern Web Application - Azure Blob Storage for Uploaded Files

local_offer Azure local_offer asp.net core local_offer dotnetcore

visibility 273
thumb_up 0
access_time 3 months ago

With cloud platforms like Azure, we can totally separate user content storage from web application storage to decouple components from each other and to make the application easy to scale and deploy. This article provides detailed information with code snippets about how to use Azure server-less product Blob Storage and App Service to enable horizontally scalable web application for users to upload files (BLOBs).

open_in_new Azure

Machine Learning with .NET in Jupyter Notebooks

local_offer plot local_offer machine-learning local_offer jupyter-notebook local_offer C# local_offer dotnet core

visibility 473
thumb_up 0
access_time 7 months ago

In this article, I'm going to show you how to install Jupyter in Windows and then install .NET kernel for Jupyter notebooks. It also shows a machine learning example using ML.NET. The target audience are .NET developers who want to expand their skills in data engineering and science domain...

open_in_new .NET Machine Learning

info About author

comment Comments (0)

comment Add comment

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

No comments yet.

Dark theme mode

Dark theme mode is available on Kontext.

Learn more arrow_forward

Kontext Column

Created for everyone to publish data, programming and cloud related articles. Follow three steps to create your columns.


Learn more arrow_forward