HTTP GET works in browser, but doesn't with HTTPWebRequest

Title explains it. I am trying to change the password of a webpage programmatically using HTTP Web Request. When I do it through Google Chrome (pasting the uri in the address bar), the password change works. Here is the header I get when I inspect in Chrome.

Remote Address:10.160.70.55:443
Request URL:https://10.160.70.55/cgi-bin/check_user.cgi?Type=basic&Current=78-62-118-112-106-108-56&Password=98-96-102-96-106-96
Request Method:GET

Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8,fr;q=0.6,ar;q=0.4
Authorization:Digest username="admin", realm="Secure Access", nonce="f3c6fcd9a549a42e9aac22818cb0f5ad", uri="/cgi-bin/check_user.cgi?Type=basic&Current=78-62-118-112-106-108-56&Password=98-96-102-96-106-96", response="cd17523a279f044d086b5bd0245eda0e", qop=auth, nc=0000001b, cnonce="9bd719c27efd9721"
Connection:keep-alive
Host:10.160.70.55

When I try to do it programatically, I receive the OK (200) code, but the password change does not work. Here's my code.

System.Uri uri2 = new Uri(string.Format("https://{0}/cgi-bin/check_user.cgi?Type=basic&Current=78-62-118-112-106-108-56&Password=98-96-102-96-106-96", ip));
                        HttpWebRequest request2 = (HttpWebRequest)WebRequest.Create(uri) as HttpWebRequest;
                        request2.Accept = "text/html";
                        request2.Credentials = new NetworkCredential("admin", "M@ster1");
                        request2.Method = WebRequestMethods.Http.Get;
                        HttpWebResponse response2 = (HttpWebResponse)request.GetResponse();
                        WriteLog(response2.StatusDescription.ToString());

                        response2.Close();

Answers


Used fiddler as suggested, and it turns out it was the user-agent header. And thank you for correcting the typo L.B. :)


Need Your Help

Binding List<DataTime> to DataGrid Header

wpf list datetime data-binding datagrid

Hi I have list of days in given month and I would like to bind this list to datagrid control.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.