3
Reply

How can I get the client's IP address in ASP.Net MVC 4 razor

Ramsès Zogning II

Ramsès Zogning II

Dec 12 2014 5:28 PM
1.8k

How can I get the client's IP address in ASP.Net MVC 4 razor and put it in the table of my Model ?
i tried this : 
var Ip = this.HttpContext.Request.ServerVariables["REMOTE_ADDR"];

but it's return me "::1"
i suppose that it's in ipv6

it's a true Ip on my computer (or browser). If it's true, i will not affray because i know that i'm connet to a localhost of visual.


Plz help me


Thank


Answers (3)