[Mono-list] System.Net.WebRequest.CachePolicy not implemented?

Bálint Kardos balint at cardos.hu
Tue Nov 4 16:56:18 EST 2008


I'm doing a WebRequest, and need to set the CachePolicy. I've copied the
code from MSDN.
http://msdn.microsoft.com/en-us/library/system.net.cache.httprequestcachepolicy.aspx

string url = "http://api.mydevserver.hu";

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

System.Net.Cache.HttpRequestCachePolicy noCachePolicy = new
 System.Net.Cache.HttpRequestCachePolicy(System.Net.Cache.HttpRequestCacheLevel.NoCacheNoStore);
request.CachePolicy = noCachePolicy;
Encoding enc = System.Text.Encoding.GetEncoding(1252);
StreamReader loResponseStream = new
StreamReader(response.GetResponseStream(), enc);

string responsetext = loResponseStream.ReadToEnd();
loResponseStream.Close();
response.Close();


Mono 2.0, XSP 2.0.1:

System.NotImplementedException: This method must be implemented in
derived classes
  at System.Net.WebRequest.set_CachePolicy
(System.Net.Cache.RequestCachePolicy value) [0x00000] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.0.1\mcs\class\System\System.Net\WebRequest.cs:108
  at X.Search.WebRequestHandler (System.String url) [0x00000]


MS.Net 2.0/3.5 works fine.

b.

üdvözlettel
with regards

Kardos Bálint
_______________________________________
http://skaelede.hu 10 (0xA) év a magyar weben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20081104/e07c2025/attachment-0001.html 


More information about the Mono-list mailing list