Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WP7 HttpWebRequest without caching

It seems that HttpWebRequest caching in WP7 is enabled by default, how do I turn it off? Adding a random param url + "?param=" + RND.Next(10000) works, but it's quite tricky and I'm not sure if it will work with all servers.

like image 273
Janci Avatar asked Dec 16 '10 14:12

Janci


1 Answers

For future reference , this worked for me ( I could not use additional query parameter due to project requirements) :

        HttpWebRequest request = HttpWebRequest.CreateHttp(url);
        if (request.Headers == null)
        {
            request.Headers = new WebHeaderCollection();
        }
        request.Headers[HttpRequestHeader.IfModifiedSince] = DateTime.UtcNow.ToString();
like image 164
frno Avatar answered Oct 28 '22 09:10

frno