Fetching content of a browser without the use of http webrequest
<p>Well, I am trying to search for a way to fetch web content via code without the use of http web request. Basically what I am trying to achieve is to get the content of the page my using a browser. I don’t want an instance of the browser and no httpwebrequest; Something to Replace webrequest  to a browser based request without actually using a browser. I am not even sure if this is possible though. Any lead or help would be greatly appreciated. Thanks for reading me out :)</p>

<p>Below is the code using http web request if that helps in any way.</p>

<pre><code>public static HttpStatusCode? ExecuteWebRequest(string url, CookieCollection cookies, out string content, out WebHeaderCollection headers, out long? executionTimeInMs, string proxy)
            {
                HttpWebRequest request = null;
                Stopwatch sw = new Stopwatch();
                HttpStatusCode? statusCode = null;

                executionTimeInMs = null;
                content = null;
                headers = null;

                WebRequest req = WebRequest.Create(url);

                // When running unit tests, the path may be to a local file.
                if (req is FileWebRequest)
                {
                    WebResponse response = req.GetResponse();

                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                    {
                        content = reader.ReadToEnd();
                    }

                    statusCode = HttpStatusCode.OK;
                    executionTimeInMs = 100;
                    headers = response.Headers;
                    return statusCode;
                }

                // Set the proxy if there is one.
                if (proxy != null &amp;&amp; proxy.Length &gt; 0)
                {
                    WebProxy proxyObject = new WebProxy(proxy, true);
                    req.Proxy = proxyObject;
                }
                else
                {
                    req.Proxy = null;
                }

                request = (HttpWebRequest)req;
                if (cookies != null)
                {
                    request.CookieContainer = new CookieContainer();
                    foreach (Cookie cookie in cookies)
                   {
                        request.CookieContainer.Add(new Uri(url), cookie);
                    }
                }

                sw.Reset();
                sw.Start();
                HttpWebResponse webResponse = null;
                try
                {
                    webResponse = (HttpWebResponse)request.GetResponse();
                    sw.Stop();

                    headers = webResponse.Headers;

                    if (webResponse.StatusCode == HttpStatusCode.OK)
                    {
                        StreamReader reader = new StreamReader(webResponse.GetResponseStream());
                        content = reader.ReadToEnd();
                        reader.Close();
                    }

                    executionTimeInMs = sw.ElapsedMilliseconds;
                    statusCode = webResponse.StatusCode;
                }
                catch (WebException we)
                {
                    sw.Stop();
                    executionTimeInMs = sw.ElapsedMilliseconds;

                    if (we.Response != null)
                    {
                        statusCode = (we.Response as HttpWebResponse).StatusCode;
                    }

                    throw we;
                }
                finally
                {
                    if (null != webResponse)
                    {
                        webResponse.Close();
                    }
                }

                return statusCode;
            }
</code></pre>
