在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
using System.Web; namespace Wxlhjcyy.Public { public class GetIp { public static string IPAddress { get { string userIP; HttpRequest Request = HttpContext.Current.Request; // ForumContext.Current.Context.Request; // 如果使用代理,获取真实IP userIP = Request.UserHostAddress; if (string.IsNullOrEmpty(userIP)) { if (Request.ServerVariables["HTTP_X_FORWARDED_FOR"] != "") userIP = Request.ServerVariables["REMOTE_ADDR"]; else userIP = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; } return userIP; } } } }
|
请发表评论