Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string ipAddress = "unknown";
            string msisdn    = "unknown";

            try
            {
                ipAddress = Convert.ToString(Request.ServerVariables["REMOTE_ADDR"]);
            }
            catch
            {
            }

            try
            {
                WapXzone_VNM.MsisdnService.MsisdnService msidsnService = new WapXzone_VNM.MsisdnService.MsisdnService();
                msisdn = msidsnService.GetVietnamobileMsisdn(ipAddress);
            }
            catch
            {
            }


            #region Log
            ILog logger = log4net.LogManager.GetLogger(Session["telco"].ToString());
            logger.Debug("--------------------------------------------------");
            logger.Debug(String.Format("REMOTE_ADDR: {0}", Request.ServerVariables["REMOTE_ADDR"]));
            logger.Debug(String.Format("REMOTE_HOST: {0}", Request.ServerVariables["REMOTE_HOST"]));
            logger.Debug(String.Format("HTTP_HOST: {0}", Request.ServerVariables["HTTP_HOST"]));
            logger.Debug(String.Format("HTTP_X_FORWARDED_HOST: {0}", Request.ServerVariables["HTTP_X_FORWARDED_HOST"]));
            logger.Debug("MSISDN: " + msisdn);
            logger.Debug("IP: " + ipAddress);
            logger.Debug(String.Format("Current Url: {0}", Request.RawUrl));
            #endregion

            Response.Write(msisdn);
            Page.Title = msisdn;
        }
Пример #2
0
        public static string GetMSISDN1()
        {
            ILog logger = log4net.LogManager.GetLogger("File");

            logger.Info("msisdn out :" + "F**k");

            //phoneno = HttpContext.Current.Request.ServerVariables.Get("HTTP_X_UP_CALLING_LINE_ID");
            //phoneno += HttpContext.Current.Request.ServerVariables.Get("HTTP_MSISDN");
            //phoneno += HttpContext.Current.Request.ServerVariables.Get("HTTP_X_FH_MSISDN");
            //phoneno = HttpContext.Current.Request.ServerVariables["MSISDN"];
            //phoneno += HttpContext.Current.Request.ServerVariables.Get("User-Identity-Forward-msisdn");
            //phoneno += HttpContext.Current.Request.ServerVariables.Get("HTTP_X_MSISDN");
            //phoneno += HttpContext.Current.Request.ServerVariables.Get("X-MSISDN");
            //phoneno += HttpContext.Current.Request.Headers.Get("X-WAP-MSISDN");
            try
            {
                string msisdn = HttpContext.Current.Request.Headers.Get("MSISDN");

                //logger.Info("msisdn out :" + msisdn);

                if (String.IsNullOrEmpty(msisdn))
                {
                    string ipAddress = GetClientIPAddress();

                    logger.Info("ISING-IP :" + ipAddress);

                    //if (System.Text.RegularExpressions.Regex.IsMatch(ipAddress, @"^10\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}$"))
                    //{

                    logger.Info("ISING-msisdn in :" + msisdn);

                    try
                    {
                        WapXzone_VNM.MsisdnService.MsisdnService msidsnService = new WapXzone_VNM.MsisdnService.MsisdnService();
                        msisdn = msidsnService.GetVietnamobileMsisdn(ipAddress);

                        logger.Info(" ");
                        logger.Info(" ");
                        logger.Info("--------------------ISING------------------------------");
                        logger.Info(String.Format("ISING-REMOTE_ADDR: {0}", HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]));
                        logger.Info(String.Format("ISING-REMOTE_HOST: {0}", HttpContext.Current.Request.ServerVariables["REMOTE_HOST"]));
                        logger.Info(String.Format("ISING-HTTP_HOST: {0}", HttpContext.Current.Request.ServerVariables["HTTP_HOST"]));
                        logger.Info(String.Format("ISING-HTTP_X_FORWARDED_HOST: {0}", HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_HOST"]));
                        logger.Info(String.Format("ISING-HTTP_X_FORWARDED_FOR: {0}", HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]));
                        logger.Info("ISING-MSISDN: " + msisdn);
                        logger.Info("ISING-IP: " + ipAddress);
                        //logger.Info(String.Format("Current Url: {0}", HttpContext.Current.Request.RawUrl));
                        logger.Info("--------------------ISING------------------------------");
                        logger.Info(" ");
                        logger.Info(" ");
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        logger.Error(ex.StackTrace);
                    }
                    logger.Info("ISING-MSISDN111: " + msisdn);
                    return(msisdn);
                    //}
                    //else
                    //{

                    //    logger.Info("ISING-msisdn in : is3g = 2");
                    //    return String.Empty;

                    //}
                }
                else
                {
                    logger.Info("ISING-msisdn in : is3g = 0;");
                    return(msisdn);
                }
            }
            catch (Exception ex)
            {
                logger.Error("Ising.vn" + ex.ToString());
                throw;
            }


            //return msisdn == "unknown" ? String.Empty : msisdn;
        }