Get Client IP Address in ASP.NET Core 2.0 Razor Pages #aspnetcore

added by DotNetKicks
11/2/2017 8:09:29 PM

2 Kicks, 116 Views

In this short post, find the code to get client IP address in ASP.NET Core 2.0 Razor pages . You need to inject IHttpContextAccessor in razor page using @inject. You can inject a service into a view using the @inject directive. You can think of @inject as adding a property to your view, and populating the property using DI.


0 comments