Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8084335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:45:48+00:00 2026-06-05T17:45:48+00:00

We are facing one problem with DownloadStringCompleted method always returning same result in windows

  • 0

We are facing one problem with DownloadStringCompleted method always returning same result in windows phone 7?

First binding the pending requests through service.showing that requuest in listbox placed two buttons.when click on that calling accept service that service update the table.
again while calling the pending request service showing previous result.why please tell me…

Code:

private void getpendingrequests()
{
 WebClient wcgetfriends = new WebClient();
                    wcgetfriends.DownloadStringAsync(
                    new Uri("http://{ipaddress}/Network/Reccords/GetFriends?userid=" + userId));
                    wcgetfriends.DownloadStringCompleted +=
                     new DownloadStringCompletedEventHandler(
                                    wcgetfriends_DownloadStringCompleted);
}



 void wcgetfriends_DownloadStringCompleted(object sender,
                 DownloadStringCompletedEventArgs e)
        {

            String resultgetfriends = null, responseCode = null;
            using (var reader = new StringReader(e.Result))
            {
                resultgetfriends = reader.ReadToEnd();
            }
            XmlReader xmlDoc = XmlReader.Create(new MemoryStream(System.Text.UTF8Encoding.UTF8.GetBytes(resultgetfriends)));

            while (xmlDoc.Read())
            {
                if (xmlDoc.NodeType == XmlNodeType.Element)
                {

                    if (xmlDoc.Name.Equals("ResponseCode"))
                    {
                        responseCode = xmlDoc.ReadInnerXml();

                    }

                }

            }
            if (Convert.ToInt32(responseCode) == 200)
            {

                string result1 = e.Result.ToString();

                XDocument xmlDocu = XDocument.Load(new MemoryStream(System.Text.UTF8Encoding.UTF8.GetBytes(result1)));

                interestrates = (from rts in xmlDocu.Descendants("Friend")

                                 select new SampleCheckedData
                                 {

                                     Id = (string)rts.Element("userid"),
                                     Name = (string)rts.Element("name"),
                                     Icon = (string)rts.Element("imageurl"),

                                 }).ToObservableCollection<SampleCheckedData>();


                this.lstFriendRequuest.ItemsSource = interestrates;

            }
            if (Convert.ToInt32(responseCode) == 201)
            {
                MessageBox.Show("UserId is not type of integer");
            }
            if (Convert.ToInt32(responseCode) == 202)
            {
                MessageBox.Show("User not exists");
            }
            if (Convert.ToInt32(responseCode) == 203)
            {
                MessageBox.Show("No Pending Requests");
            }

        }

private void requestaccept()
{
 WebClient wcacceptrequest = new WebClient();
                    wcacceptrequest.DownloadStringAsync(
                    new Uri("http://{ipaddress}/Network/Reccords/FriendRequestAcceptance?userid=" + userId + "&frienduserid=" + _id + "&acceptid=" + 1));
                    wcacceptrequest.DownloadStringCompleted +=
                     new DownloadStringCompletedEventHandler(
                                    wcacceptrequest_DownloadStringCompleted);
                    Image b = sender as Image;
                    var res = interestrates.Where(a => a.Id.Equals(((System.Windows.FrameworkElement)(e.OriginalSource)).Tag)).ToList();
                    if (res.Count == 1)
                        interestrates.Remove(res.First());
}

   void wcacceptrequest_DownloadStringCompleted(object sender,
                DownloadStringCompletedEventArgs e)
        {

            String resultaccept = null, responseCode = null;
            using (var reader = new StringReader(e.Result))
            {
                resultaccept = reader.ReadToEnd();
            }
            XmlReader xmlDoc = XmlReader.Create(new MemoryStream(System.Text.UTF8Encoding.UTF8.GetBytes(resultaccept)));

            while (xmlDoc.Read())
            {
                if (xmlDoc.NodeType == XmlNodeType.Element)
                {

                    if (xmlDoc.Name.Equals("ResponseCode"))
                    {
                        responseCode = xmlDoc.ReadInnerXml();

                    }

                }

            }
            if (Convert.ToInt32(responseCode) == 200)
            {

                lstFriendRequuest.ItemsSource = "";
                interestrates = new ObservableCollection<SampleCheckedData>();
                bindGetFriends();

            }
            if (Convert.ToInt32(responseCode) == 201)
            {
                MessageBox.Show("UserId is not type of integer");
            }
            if (Convert.ToInt32(responseCode) == 202)
            {
                MessageBox.Show("Friend Id not type of integer");
            }
            if (Convert.ToInt32(responseCode) == 203)
            {
                MessageBox.Show("Accept id not type of integer");
            }

        }

please tell me why in bindfriends method getting previous result……

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T17:45:51+00:00Added an answer on June 5, 2026 at 5:45 pm

    This is almost certainly being caused by caching either within the phone or within some network proxy.

    There are several things you can try to do in order to prevent caching – if you want to always disable the caching then one of the quickest is to add a unique number to the end of your GET request – e.g.

                    WebClient wcgetfriends = new WebClient();
                    wcgetfriends.DownloadStringCompleted += wcgetfriends_DownloadStringCompleted;
                    wcgetfriends.DownloadStringAsync(
                        new Uri(
                            "http://{ipaddress}/Network/Reccords/GetFriends?userid=" 
                            + userId 
                            + "&ignored=" 
                            + DateTime.UtcNow.Ticks));
    

    There are other similar questions and answers at:

    • WP7 HttpWebRequest without caching
    • WebClient download weird behavior
    • Should I disable WebClient caching?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing the same problem as the below one. Does any one has
I currently working with PictureBox and facing one problem. First, I have drawn one
I'm probably not the first one facing this problem, but I couldn't find a
I am facing one problem in setting the scollbar in tableviewer. I have around
i am facing one problem.i have a class named ReportingService and it should be
I am learning OpenCV using Learning OpenCV book. One problem I am facing while
I am facing a problem while disabling the command button after one click. I
My app is facing a problem. My app has a button in one activity
I am facing one problem ,that when the google map is loading then there
We are facing one problem in managing test data (xmls which is used to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.