Open a WebResponse on Browser

4k views Asked by At

I have a Request which I make to a page and works fine. I can also view that page the response page with Fiddler.

But how do I open this response in my browser?

Currently what I have:

            Cookie cookie = new Cookie("test","this");
            cookie.Domain = "foobar";


            HttpWebRequest request = (HttpWebRequest) HttpWebRequest.Create("http://foobar/ReportServer/");
            request.CookieContainer = new CookieContainer();
            request.CookieContainer.Add(cookie);

            WebResponse response = request.GetResponse();
            Stream sr = response.GetResponseStream();
            StreamReader sre = new StreamReader(sr);
            string s = sre.ReadToEnd();
            Response.Write(s);
3

There are 3 answers

0
Farzan Hajian On

You can use System.Windows.Forms.WebBrowser control.

1
JWP On

Because you have addressibility to the request "Stream" you can use this method: NavigateToStream : http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser.navigatetostream(v=vs.100).aspx

  this.webBrowser.NavigateToStream(sr);
3
CodeCaster On