Skip to main content
Home Forums Silverlight Programming Report a Silverlight Bug Web Request to Same URI in IE 7
2 replies. Latest Post by justice on June 27, 2008.
(1)
justice
Member
0 points
2 Posts
06-25-2008 3:06 AM |
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 Ch...
Star
13862 points
1,803 Posts
06-27-2008 4:26 AM |
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
06-27-2008 11:16 AM |
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.