Inheritance: System.Net.WebClient
        public static async Task<string> GetHttpAsync(string url, int count = 3)
        {
            var client = new CookieClient();
            var content = string.Empty;
            try
            {
                // If user is NOT authenticated (cookie got deleted in GetWebResponse()), return empty result
                if (String.IsNullOrEmpty(Settings.Default.sessionid))
                {
                    return string.Empty;
                }

                content = await client.DownloadStringTaskAsync(url);
            }
            catch (Exception ex)
            {
                Logger.Exception(ex, "CookieClient -> GetHttpAsync, for url = " + url);
            }
            return content;
        }
示例#2
0
        public static async Task <string> GetHttpAsync(string url, int count = 3)
        {
            var client  = new CookieClient();
            var content = string.Empty;

            try
            {
                // If user is NOT authenticated (cookie got deleted in GetWebResponse()), return empty result
                if (String.IsNullOrEmpty(Storage.SessionId))
                {
                    return(string.Empty);
                }

                content = await client.DownloadStringTaskAsync(url);
            }
            catch (Exception ex)
            {
                Logger.Exception(ex, "CookieClient -> GetHttpAsync, for url = " + url);
            }
            return(content);
        }