Reputation: 48
I want create cache some files .js
after windows initialization with my console application, but i'm not able.
My code:
var tempFilePath = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);
var filePath = Path.Combine(tempFilePath,"My.js");
var requestFile = (HttpWebRequest)HttpWebRequest.Create("http://my-address/My.js");
requestFile.Method = "GET";
var httpResponse = (HttpWebResponse)(requestFile.GetResponse());
using (var responseStream = httpResponse.GetResponseStream())
{
var myJS = new StreamReader(responseStream).ReadToEnd();
File.WriteAllText(filePath, myJS);
}
Upvotes: 1
Views: 878
Reputation: 39
So, in order to write files directly to the IE cache folder, you'll need to use wininet.dll
You can use the CreateUrlCacheEntry
and CommitUrlCacheEntryW
functions to inject files into the cache.
Upvotes: 1