We help IT Professionals succeed at work.

response info - HttpWebRequest

HLRosenberger used Ask the Experts™
I am using HttpWebRequest to download the contents of a WEB page.  The page is a login page.  I am fairly certain that I am logged in, based on the responseData, which is a copy of the login page without any errors.  However, how do I get the HTTP response data, like code 200, etc, so that I know it worked?   And how do I "navigate" to the "next" page, i.e., the next page that my browser would show after login?

Here's if what  am doing now to get the response data:

 responseReader = New StreamReader(webRequest.GetResponse().GetResponseStream())
 responseData = responseReader.ReadToEnd()
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
var req = WebRequest.Create("http://www.google.com");
            var response = req.GetResponse() as HttpWebResponse;

            if(response!=null && response.StatusCode==HttpStatusCode.OK)
                req=WebRequest.Create("http://www.yahoo.com"); //next page
                //check the response similar way

Open in new window