文章來自 http://jashliao.pixnet.net/blog/post/223322602-c%23-httpwebrequest-%E5%AD%98%E5%8F%96-web-api-%E4%B8%8D%E8%A6%81%E6%9C%89cache%E7%9A%84%E5%AF%AB%E6%B3%95
片段程式碼:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
//--
//定義此req的緩存策略
//https://msdn.microsoft.com/zh-tw/library/system.net.webrequest.cachepolicy(v=vs.110).aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1
HttpRequestCachePolicy noCachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore);
request.CachePolicy = noCachePolicy;
//--
request.Method = "GET";//request.Method = "POST";
文章標籤
全站熱搜
留言列表