Hi,
I am a systems guy and currently doing a part time web development project so am pretty new to it. I am trying to write a http client for www.portapower.com . Basically what it will do is check for certain items which are posted on the website and if they match a particular requirement it will print a message. While trying to access this page: http://www.portapower.com/getbainfo.php?fclasscode=1&code=CB1831B.40H&fbrand=QUNFUg== the website redirects me to a default register page http://www.portapower.com/defaregit.php. Here is a snippet of what I coded
CookieContainer myContainer = new CookieContainer();
HttpWebRequest request = (HttpWebRequest)
WebRequest.Create("http://www.portapower.com/" + urlpart);
request.Credentials = new NetworkCredential("****", "******");
request.CookieContainer = myContainer;
request.PreAuthenticate = true;
request.Method = "POST";
HttpWebResponse response = (HttpWebResponse)
request.GetResponse();
Console.WriteLine(response.StatusCode);
Stream resStream = response.GetResponseStream();
Console.WriteLine(resStream.ToString());
I do have the username and password and it works fine when used from a browser. Please tell me if this a correct way to access a authenticated page.