Reputation: 154
Please tell me why it works only once? I want to create a button to update the time, but my app only shows me the first time I got
public async void q()
{
HttpClient client = new HttpClient();
HttpResponseMessage response = await client.GetAsync("http://cleverapps.ru/wp.php");
string getResponsestring = await response.Content.ReadAsStringAsync();
MessageBox.Show(getResponsestring);
}
private void ApplicationBarIconButton_Click(object sender, EventArgs e)
{
q();
}
Upvotes: 0
Views: 106
Reputation: 1257
This probably happens because caching is enabled by default.
Try adding the following line before making the GetAsync call:
client.DefaultRequestHeaders.IfModifiedSince = DateTime.UtcNow;
Upvotes: 3