Linked Questions

10 votes
2 answers
33k views

I try to get remote (client) IP addres: var ip = httpContext.Features.Get<IHttpConnectionFeature>()?.RemoteIpAddress But it works only for local requests (it will return ::1 value) When I load ...
hcp's user avatar
  • 3,509
0 votes
1 answer
741 views

I'm trying to learn ASP.NET Core and I'm making a WhatismyIP website. I've searched for a way to get the client IP address and I found HttpContext.GetServerVariable("REMOTE_ADDR") but for ...
Wilix's user avatar
  • 23
0 votes
0 answers
72 views

In ASP .Net Core, the below code always returning 127.0.0.1 (The Local IP)when deployed in Internet enable site httpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString(); Tried the below ...
Santhoshkumar Kannan's user avatar
0 votes
0 answers
37 views

I am working on a log of logins for security issues in user accounts, so I want to record the location and device from which users log in, this to alert of possible suspicious logins with their ...
Deybi Tabora Paz's user avatar
439 votes
23 answers
769k views

We have Request.UserHostAddress to get the IP address in ASP.NET, but this is usually the user's ISP's IP address, not exactly the user's machine IP address who for example clicked a link. How can I ...
Mehdi's user avatar
  • 5,617
68 votes
7 answers
195k views

I understand it's a standard practice to look at both these variables. Of course they can easily be spoofed. I'm curious how often can you expect these values (especially the HTTP_X_FORWARDED_FOR) to ...
User's user avatar
  • 31.1k
62 votes
4 answers
36k views

What is the equivalent in ASP.NET Core of ASP.NET Framework's HttpContext.Request.UserHostAddress? I tried this.ActionContext.HttpContext but cannot find the UserHostAddress nor the ServerVariables ...
Francesco Cristallo's user avatar
49 votes
1 answer
34k views

I am working on internal libraries for my organization. I need to reference certain types that normally "belong" to web apps, eg. to provide some extensions: WebApplicationOptions ...
Rast's user avatar
  • 2,631
26 votes
9 answers
39k views

How do I get client information such as IP adress and browser name/version in Blazor server-side?
jsmars's user avatar
  • 1,948
30 votes
7 answers
57k views

I'm working on ASP.Net Core 2.1 with Angular Template provided by Microsoft Visual Studio 2017. My Client App is working fine. After competition of User Authentication, I want to start User Session ...
Ahmer Ali Ahsan's user avatar
33 votes
3 answers
40k views

In the properties section of my network card, on windows server 2008, i have IPV6 disabled, leaving only IPV4 enabled. However in ASP.NET, Request.UserHostAddress returns '::1', an IPV6 address. Has ...
maxp's user avatar
  • 25.2k
29 votes
2 answers
28k views

IP Address, and such like. Very often when users ask how to do it in Server Blazor app, they are either told that it is not possible, or sometimes offered partial solutions employing JSInterop. But ...
enet's user avatar
  • 46.3k
23 votes
5 answers
54k views

I want to read the value of the X-Forwarded-For header value in a request. I've tried HttpContext.Current.Request.Headers["X-Forwarded-For"].Split(new char[] { ',' }).FirstOrDefault(); in C#. OR ...
Kuttan Sujith's user avatar
13 votes
3 answers
20k views

var test1 = HttpContext.Features.Get<IHttpConnectionFeature>(); var test2 = HttpContext.Connection.RemoteIpAddress; When running the application locally on IISExpress, these two lines correctly ...
A-Sharabiani's user avatar
  • 19.6k
17 votes
2 answers
17k views

I am trying to restrict a site by IP address. In previous MVC versions I'd add something like the following to the web.config: <security> <ipSecurity allowUnlisted="false" denyAction="...
MartinM's user avatar
  • 1,816

15 30 50 per page