Пример #1
0
        private List <vpn_Entry> getRemoteVpn()
        {
            string           Url    = System.Configuration.ConfigurationManager.AppSettings["Url"].ToString();
            string           _keys  = System.Configuration.ConfigurationManager.AppSettings["Keys"].ToString();
            string           data   = "Keys=" + _keys;
            string           result = string.Empty;
            List <vpn_Entry> r      = new List <vpn_Entry>();

            try
            {
                result = HttpGetPost.PostDataToUrl(data, Url);
                Program.logWriting("服务器返回数据:" + result);
                if (string.IsNullOrEmpty(result))
                {
                    flushException();
                }
                r            = JsonConvert.DeserializeObject <List <vpn_Entry> >(result);
                isConnServer = true;
            }
            catch (Exception e)
            {
                isConnServer       = false;
                DialButton.Enabled = false;
                Program.logWriting("Exception! 服务器不可达!请联系管理员。 " + e.Message);
                StatusTextBox.Text = "服务器不可达!请联系管理员。" + e.Message;
            }
            return(r);
        }
Пример #2
0
        private void flushException()
        {
            string     result = string.Empty;
            string     url    = string.Empty;
            string     Url    = System.Configuration.ConfigurationManager.AppSettings["Url"].ToString();
            UriBuilder ub     = new UriBuilder(Url);

            ub.Path = "Default/flushClientException/dialer";
            try
            {
                result = HttpGetPost.RequestGet(ub.ToString());
            }
            catch (Exception e) { result = e.Message; }

            Program.logWriting("刷新异常结果:" + result);
        }
Пример #3
0
        internal static List <vpn_Entry> getRemoteVpn()
        {
            string           Url    = System.Configuration.ConfigurationManager.AppSettings["Url"].ToString();
            string           _keys  = System.Configuration.ConfigurationManager.AppSettings["Keys"].ToString();
            string           data   = "Keys=" + _keys;
            string           result = string.Empty;
            List <vpn_Entry> r      = new List <vpn_Entry>();

            try
            {
                result = HttpGetPost.PostDataToUrl(data, Url);
                Program.logWriting(result);
                r = JsonConvert.DeserializeObject <List <vpn_Entry> >(result);
            }
            catch (Exception e)
            {
                logWriting("服务器不可达!" + e.Message);
            }
            return(r);
        }