3
Answers

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

Ramsès Zogning II

Ramsès Zogning II

9y
1.8k
1

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)