c# - Get client's IP address using .NET Standard 1.4 -
i writing .net standard library log users' ip address whenever trying login system. checked .net api browser , couldn't find system.web
api in .net standard 1.x can't use httpcontext
ip. there can use in .net standard 1.x client's ip address?
thanks.
try this
private string getuserip() { string iplist = request.servervariables["http_x_forwarded_for"]; if (!string.isnullorempty(iplist)) { return iplist.split(',')[0]; } return request.servervariables["remote_addr"]; }
Comments
Post a Comment