using (var client = new HttpClient())
            {

               //方法1:

                CacheControlHeaderValue cacheControl = new CacheControlHeaderValue();
                cacheControl.NoCache = true;
                cacheControl.NoStore = true;
                client.DefaultRequestHeaders.CacheControl = cacheControl;

               //方法2:

                //client.DefaultRequestHeaders.Add("Cache-Control", "no-cache");
                try
                {
                    client.GetStringAsync(url);
                    return true;
                }
                catch
                {
                    return false;
                }
            }

相关文章:

  • 2021-09-14
  • 2021-12-15
  • 2022-01-13
  • 2021-12-06
  • 2021-11-22
  • 2021-06-03
  • 2021-11-30
  • 2021-08-10
猜你喜欢
  • 2021-09-14
  • 2021-11-05
  • 2022-12-23
  • 2022-12-23
  • 2021-07-03
  • 2021-11-29
  • 2022-01-12
相关资源
相似解决方案