K
kkelly1
Guest
private static void GenerateGetRequest()
{
//Generate get request
HttpRequestCachePolicy policy = new HttpRequestCachePolicy(HttpRequestCacheLevel.Default);
HttpWebRequest.DefaultCachePolicy = policy;
string url = "http://kk240566-001-site1.smarterasp.net/RestWebService/employee?id=7248";
HttpWebRequest GETRequest = (HttpWebRequest)WebRequest.Create(url);
GETRequest.Method = "GET";
HttpRequestCachePolicy noCachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore);
GETRequest.CachePolicy = noCachePolicy;
Console.WriteLine("Sending GET Request");
HttpWebResponse GETResponse = (HttpWebResponse)GETRequest.GetResponse();
Stream GETResponseStream = GETResponse.GetResponseStream();
Console.WriteLine("IsFromCache? {0}", GETResponse.IsFromCache);
StreamReader sr = new StreamReader(GETResponseStream);
Console.WriteLine("Response from Server");
Console.WriteLine(sr.ReadToEnd());
Console.ReadLine();
}
problem is, i execute request and data is retrieved, change data using mssql management tools, reissue request, old data is retrieved, yet IsFromCache says False. I have treid several different options (outputcahe enabled =false, etc) in my web.config without success.
Thing is, if I change i.e. enter and delete space, in web.config, then data is refreshed.
any help greatly appreciated
Continue reading...
{
//Generate get request
HttpRequestCachePolicy policy = new HttpRequestCachePolicy(HttpRequestCacheLevel.Default);
HttpWebRequest.DefaultCachePolicy = policy;
string url = "http://kk240566-001-site1.smarterasp.net/RestWebService/employee?id=7248";
HttpWebRequest GETRequest = (HttpWebRequest)WebRequest.Create(url);
GETRequest.Method = "GET";
HttpRequestCachePolicy noCachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore);
GETRequest.CachePolicy = noCachePolicy;
Console.WriteLine("Sending GET Request");
HttpWebResponse GETResponse = (HttpWebResponse)GETRequest.GetResponse();
Stream GETResponseStream = GETResponse.GetResponseStream();
Console.WriteLine("IsFromCache? {0}", GETResponse.IsFromCache);
StreamReader sr = new StreamReader(GETResponseStream);
Console.WriteLine("Response from Server");
Console.WriteLine(sr.ReadToEnd());
Console.ReadLine();
}
problem is, i execute request and data is retrieved, change data using mssql management tools, reissue request, old data is retrieved, yet IsFromCache says False. I have treid several different options (outputcahe enabled =false, etc) in my web.config without success.
Thing is, if I change i.e. enter and delete space, in web.config, then data is refreshed.
any help greatly appreciated
Continue reading...