Linked Questions
                        34 questions linked to/from How do I get client IP address in ASP.NET Core?
                    
                
            
            
                10
            
            votes
        
        
            
                2
            
            answers
        
        
            
                33k
            
            views
        
        
            
            
            
        ASP.NET Core: How to get remote IP address? [duplicate]
                    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 ...
                
            
       
        
            
                0
            
            votes
        
        
            
                1
            
            answer
        
        
            
                741
            
            views
        
        
            
            
            
        GetServerVariable("REMOTE_ADDR") always returning null in ASP.NET Core [duplicate]
                    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 ...
                
            
       
        
            
                0
            
            votes
        
        
            
                0
            
            answers
        
        
            
                72
            
            views
        
        
            
            
            
        Internet enabled IIS Site always returning Local IP [duplicate]
                    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 ...
                
            
       
        
            
                0
            
            votes
        
        
            
                0
            
            answers
        
        
            
                37
            
            views
        
        
            
            
        How to get the location in the headers of a request in a .Net API? [duplicate]
                    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 ...
                
            
       
        
            
                439
            
            votes
        
        
            
                23
            
            answers
        
        
            
                769k
            
            views
        
        
            
            
            
        How to get a user's client IP address in ASP.NET?
                    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 ...
                
            
       
        
            
                68
            
            votes
        
        
            
                7
            
            answers
        
        
            
                195k
            
            views
        
        
            
            
            
        How can I get the clients IP address from HTTP headers?
                    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 ...
                
            
       
        
            
                62
            
            votes
        
        
            
                4
            
            answers
        
        
            
                36k
            
            views
        
        
            
            
            
        What is the equivalent of UserHostAddress in ASP.NET Core?
                    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 ...
                
            
       
        
            
                49
            
            votes
        
        
            
                1
            
            answer
        
        
            
                34k
            
            views
        
        
            
            
            
        How to reference ASP.NET Core 6 types in .NET 6 library?
                    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
...
                
            
       
        
            
                26
            
            votes
        
        
            
                9
            
            answers
        
        
            
                39k
            
            views
        
        
            
            
        How do I get client IP and browser info in Blazor?
                    How do I get client information such as IP adress and browser name/version in Blazor server-side?
                
            
       
        
            
                30
            
            votes
        
        
            
                7
            
            answers
        
        
            
                57k
            
            views
        
        
            
            
            
        How to get Client IP address in ASP.NET Core 2.1
                    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 ...
                
            
       
        
            
                33
            
            votes
        
        
            
                3
            
            answers
        
        
            
                40k
            
            views
        
        
            
            
            
        IIS Request.UserHostAddress returning IPV6 (::1), even when IPV6 disabled
                    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 ...
                
            
       
        
            
                29
            
            votes
        
        
            
                2
            
            answers
        
        
            
                28k
            
            views
        
        
            
        How to use the HttpContext object in server-side Blazor to retrieve information about the user, user agent
                    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 ...
                
            
       
        
            
                23
            
            votes
        
        
            
                5
            
            answers
        
        
            
                54k
            
            views
        
        
            
            
            
        Read X-Forwarded-For header
                    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 ...
                
            
       
        
            
                13
            
            votes
        
        
            
                3
            
            answers
        
        
            
                20k
            
            views
        
        
            
            
            
        RemoteIpAddress is always null
                    var test1 = HttpContext.Features.Get<IHttpConnectionFeature>();
var test2 = HttpContext.Connection.RemoteIpAddress;
When running the application locally on IISExpress, these two lines correctly ...
                
            
       
        
            
                17
            
            votes
        
        
            
                2
            
            answers
        
        
            
                17k
            
            views
        
        
            
            
            
        IP Security in Asp.Net Core
                    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="...