Opening response stream in silverlight
- by John Maloney
Hello,
I am attempting to return a image from a server using Silverlight 3. The server returns the Response stream like this:
context.Response.ContentType = imageFactory.ContentType
imgStream.WriteTo(context.Response.OutputStream)
imgStream.Close()
context.Response.End()
On the Silverlight client I am handling the stream like:
Dim request As HttpWebRequest = result.AsyncState
Dim response As HttpWebResponse = request.EndGetResponse(result)
Dim responseStream As IO.Stream = response.GetResponseStream()
I want to take that stream and open the browsers save dialog, one option I have explored is using the Html.Window.Navigate(New Uri("image url")) and this opened the correct browser default dialog but it is not an option because I need to send extended information(e.g. XML) to the server through the HttpRequest.Headers.Item and the Navigate doesn't allow this.
How can I take a Response Stream and force the default browser Save dialog to appear from the Silverlight Application without using the Html.Window.Navigate(New Uri("image url"))?