WebClient in WP7.1 app is called only once

My problem:

My WebClient is using a function in the cloud (

But it is not possible to call multiple times (for example, make an update).

Here is my code:

private void button_Click(object sender, RoutedEventArgs e)
WebClient cnt = new WebClient();
cnt.DownloadStringCompleted += new DownloadStringCompletedEventHandler(cnt_DownloadStringCompleted);
cnt.DownloadStringAsync(new Uri(""));

void cnt_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
int num = JsonHelper.FromJson<int>(e.Result);
textbox.Dispatcher.BeginInvoke(() => textbox.Text = Convert.ToString(num));


After every click, the application works fine in cnt_DownloadStringCompleted, but the result (e.Result) never changes after being updated on the server.

On Azure Service, I noticed after a break that the (Data) function is only called once (the first time).

How do I go about calling my service more than once?


source to share

2 answers

Check the server side to make sure you are not allowing caching. If you have a response context in your service, set:



Alternatively, if you are unable to do this, post the modified meaninglessness parameter to the querystring, something like:


You can generate and submit a new guide every time, or even use it DateTime.Now.Ticks.ToString()

. That being said, if you have control over the server side, remove the caching, as this is a serious hack.



I find that web requests are often cached by the emulator (maybe a real phone as well).

Here are some blog posts that mention this, as well as some solutions:



All Articles