|
@ -585,7 +585,7 @@ namespace SCP |
|
|
} |
|
|
} |
|
|
DateTime now = DateTime.Now; |
|
|
DateTime now = DateTime.Now; |
|
|
online.User = user; |
|
|
online.User = user; |
|
|
online.IPAdddress = GetExternalIpAddress();//Request.UserHostAddress;
|
|
|
online.IPAdddress = GetIp4Address(); // GetExternalIpAddress();//Request.UserHostAddress;
|
|
|
online.LoginTime = now; |
|
|
online.LoginTime = now; |
|
|
online.UpdateTime = now; |
|
|
online.UpdateTime = now; |
|
|
|
|
|
|
|
@ -2050,6 +2050,54 @@ namespace SCP |
|
|
return partCodeList; |
|
|
return partCodeList; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static string GetClientIpAddress() |
|
|
|
|
|
{ |
|
|
|
|
|
string resultIp = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; |
|
|
|
|
|
if (null == resultIp || resultIp == String.Empty) |
|
|
|
|
|
{ |
|
|
|
|
|
resultIp = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (null == resultIp || resultIp == String.Empty) |
|
|
|
|
|
{ |
|
|
|
|
|
resultIp = HttpContext.Current.Request.UserHostAddress; |
|
|
|
|
|
} |
|
|
|
|
|
return resultIp; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static string GetIp4Address() |
|
|
|
|
|
{ |
|
|
|
|
|
string IP4Address = String.Empty; |
|
|
|
|
|
|
|
|
|
|
|
if (HttpContext.Current != null) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (IPAddress IPA in Dns.GetHostAddresses(GetClientIpAddress())) |
|
|
|
|
|
{ |
|
|
|
|
|
if (IPA.AddressFamily.ToString() == "InterNetwork") |
|
|
|
|
|
{ |
|
|
|
|
|
IP4Address = IPA.ToString(); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (IP4Address != String.Empty) |
|
|
|
|
|
{ |
|
|
|
|
|
return IP4Address; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
foreach (IPAddress IPA in Dns.GetHostAddresses(Dns.GetHostName())) |
|
|
|
|
|
{ |
|
|
|
|
|
if (IPA.AddressFamily.ToString() == "InterNetwork") |
|
|
|
|
|
{ |
|
|
|
|
|
IP4Address = IPA.ToString(); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return IP4Address; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public string GetExternalIpAddress() |
|
|
public string GetExternalIpAddress() |
|
|
{ |
|
|
{ |
|
|
try |
|
|
try |
|
|