Question

i m facing a problem with WebResponse Property it is not properly updating in my Windows phone 7 application.

   ReceiveData()  // I m calling this Function recursively, With Timer.
   {

        strurl = "http://www.***Mylivedatawebsite.com/api/rates.php";
        webRequest = (HttpWebRequest)WebRequest.Create(strurl);

        webRequest.BeginGetResponse(new AsyncCallback(FinishWebRequest), null);
    }

    FinishWebRequest(IAsyncResult result)    
    {
        WebResponse resp = webRequest.EndGetResponse(result);
        StreamReader objReader = new StreamReader(resp.GetResponseStream());

        XDocument Doc = XDocument.Load(objReader); 
    }

The Doc contains the same value after parsing. Please help me out.

Was it helpful?

Solution

In a windows phone 7, usually the webservice response is cached. You can use incremental approach in the url's attribute. Here's the sample below.

static int increment= 0;
strurl = "http://www.***Mylivedatawebsite.com/api/rates.php"+ "id =" + (increment++).ToString();

In this way when the webservice wil see a different attribute id then it will make a re-request to the server.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top