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();
This IP address may not be the direct IP address of the user. For example, user may use VPN, proxy and etc.
Through user agent, we can get users’ browser information.
var userAgent = Request.Headers["User-Agent"];
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"];
I’ve just started an asp.net core 2.2 based implementation for Australia Consumer Data Standards (published by Data 61). Opening Banking initiative will follow these standards. The purpose is to help you to get familiar with these standards, especially the APIs that need to be implemented. ...View detail
.NET Framework, you can use |DataDirectory| to configure connection string when connecting to SQL Server database file via attach mode: AttachDbFilename=|DataDirectory|\dbname.mdf In .NET Core, you cannot directly set SQL Server Express connec...View detail
.NET Core is built in with dependency injection. Usually method ConfigureServices in Startup class is used to register services in the container. The signature of the method looks like the following: public void ConfigureServices(IServiceC...View detail
After upgrading to ASP.NET Core 2.1 (.NET Core SDK 2.1.301), you may encounter the following error about encoding: System.ArgumentException HResult=0x80070057 Message='Cyrillic' is not a supported encoding name. For information on defining a custo...View detail
SQLite is a self-contained and embedded SQL database engine. In .NET Core, Entity Framework Core provides APIs to work with SQLite. This page provides sample code to create a SQLite database using package Microsoft.EntityFrameworkCore.Sqlite . Create sample project ...View detail
In .NET Core 2.x, Windows Forms or WPF are not implemented since they are based on GDI+ and DirectX respectively in Windows. In .NET Core 3.0, there is plan to add Desktop Packs which includes UWP. WPF and Windows Forms. However, they will still be Windows-only. In .NET Core applications, you may...View detail