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;
}
}
本文转自94cool博客园博客,原文链接:http://www.cnblogs.com/94cool/p/5949082.html,如需转载请自行联系原作者