/// <summary>
/// 获取手机号码
/// </summary>
public static string GetMobile()
{
string mobile = string.Empty;
if (!string.IsNullOrEmpty(HttpContext.Current.Request.ServerVariables["DEVICEID"]))
{
mobile = HttpContext.Current.Request.ServerVariables["DEVICEID"];
}
if (!string.IsNullOrEmpty(HttpContext.Current.Request.ServerVariables["HTTP_X_UP_SUBNO"]))
{
mobile = HttpContext.Current.Request.ServerVariables["HTTP_X_UP_SUBNO"];
}
if (!string.IsNullOrEmpty(HttpContext.Current.Request.ServerVariables["HTTP_X_NETWORK_INFO"]))
{
mobile = HttpContext.Current.Request.ServerVariables["HTTP_X_NETWORK_INFO"];
}
if (!string.IsNullOrEmpty(HttpContext.Current.Request.ServerVariables["HTTP_X_UP_CALLING_LINE_ID"]))
{
mobile = HttpContext.Current.Request.ServerVariables["HTTP_X_UP_CALLING_LINE_ID"];
}
if (!string.IsNullOrEmpty(mobile))
{
const string pattern = @"1[358]\d{9}";
System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex(pattern);
System.Text.RegularExpressions.Match m = r.Match(mobile);
if (m.Success)
{
mobile = m.Value;
}
}
return mobile;
}
asp.net 获取手机号码
最新推荐文章于 2019-01-22 14:47:07 发布