Skip to main content

Microsoft Silverlight

Unanswered Question Web Request to Same URI in IE 7RSS Feed

(1)

justice
justice

Member

Member

0 points

2 Posts

Web Request to Same URI in IE 7

I'm not sure if anyone else can reproduce this, but the following code acts differently in IE7 as it does in Firefox.  Basically, IE7 the code executes, but there is no request registered on the service at the other end after the first request (the information from the first request is returned in the result).  In FF, the functionality is as expected (the request is new each time).  See the code below.  This is a little more convoluted than my previous attempt with the WebClient, but I think you can get the picture.

 private void myButton_Click(object sender, RoutedEventArgs e)
        {
            var request = WebRequest.Create(new Uri("http://localhost:8080/SomeResponse"));
            request.BeginGetResponse(ReadCallback, request);
        }

        private void ReadCallback(IAsyncResult asynchronousResult)
        {
            var request = (HttpWebRequest)asynchronousResult.AsyncState;
            var response = (HttpWebResponse)request.EndGetResponse(asynchronousResult);
            using (var streamReader1 = new StreamReader(response.GetResponseStream()))
            {
                string resultString = streamReader1.ReadToEnd();
                myButton.Dispatcher.BeginInvoke(new Action<string>(delegate(string value) { myButton.Content = value; }), resultString);
            }
        }

 

Best regards,

Justice

Allen Chen – MSFT
Allen Ch...

Star

Star

13862 points

1,803 Posts

Re: Web Request to Same URI in IE 7

Hi:

  From your description I think the data is cached. Try this to see if it works:

 HttpWebRequest request =(HttpWebRequest)WebRequest.Create(new Uri("http://localhost:8080/SomeResponse"));

 request .AllowReadStreamBuffering = false;

Regards

Sincerely,
Allen Chen
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.

justice
justice

Member

Member

0 points

2 Posts

Re: Web Request to Same URI in IE 7

Thank you for the response.  I figured that it was something like this.  Why did it act differently in FireFox?  There was no read stream buffering while using that browser.  Also, would that work with the webclient?  It doesn't seem very consistent.  Please let me know if you need further clarification.

Best regards,

Justice

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities