// // GET: /Tribune/ public ActionResult Index() { Dictionary <string, string> dic = new Dictionary <string, string>(); //dic.Add("secretKey", "8a90899456fd0bdd0156fd4a1db6001b"); //dic.Add("userNo", "000091"); dic.Add("param", "000091"); HttpWebResponse res = HttpRequestHelper.CreatePostHttpResponse("http://localhost:8010/Portal/KeepAlive/KeepAlivePage.aspx/KeepAliveData", dic, null, "", Encoding.UTF8, null); //HttpWebResponse res = HttpRequestHelper.CreatePostHttpResponse("http://localhost:56403/Tribune/HttpTest", dic, null, "", Encoding.UTF8, null); Stream stream = res.GetResponseStream(); //StreamReader类的Read方法依次读取网页源程序代码每一行的内容,直至行尾(读取的编码格式:UTF8) StreamReader respStreamReader = new StreamReader(stream, Encoding.UTF8); string s = respStreamReader.ReadToEnd(); return(View()); }
/// <summary> /// 获取当前的连接地址 /// </summary> /// <param name="callback"></param> public async void LikeBeePC(Action <string, Exception> callback) { await Task.Run(() => { try { ServerResult serverResult = JsonConvert.DeserializeObject <ServerResult>(HttpRequestHelper.GetResponseString(HttpRequestHelper.CreatePostHttpResponse(string.Concat(GlobalData.BaseServerUrl, "/api/BeePCLauncher/ClickBeePCLauncher"), new Dictionary <string, string>() { { "IntoType", "1" } }))); if (serverResult.StatusCode != 200) { this._logger.Error(serverResult.Data); } else { string data = serverResult.Data; int num = 1306; if (!int.TryParse(data, out num)) { callback("暂无数据", null); } else { callback(num.ToString(), null); } } } catch (Exception exception1) { Exception exception = exception1; this._logger.Error <Exception>(exception); callback("暂无数据", exception); } }); }