Beispiel #1
0
        protected HttpClient GetHttpClientWithSession()
        {
            var client = Connector.GetHttpClient();

            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(scheme: "Bearer",
                                                                                       parameter: Session["TokenNumber"].ToString() + ":" + Session["UserName"]);
            return(client);
        }
Beispiel #2
0
 protected string GetTotal(string url)
 {
     try
     {
         var client = Connector.GetHttpClient();
         HttpResponseMessage result = client.GetAsync(url).Result;
         var content = result.Content.ReadAsStringAsync().Result;
         return(content);
     }
     catch (Exception ex)
     {
         GlobalVariable.log.Write(LogLevel.Error, ex);
         return(null);
     }
 }