Hi,

How can I send http request for authentication?

My current code returns 401 unauthorized access

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://128.39.141.213/axis-cgi/com/ptz.cgi?camera=1&move=right");

HttpWebResponse response = (HttpWebResponse)request.GetResponse();

Looking for a quick reply
Regards,
A

Even after setting the credentials, I get some sort of error for if I execute the following code/instruction for 3rd time. For the first two times, it performs well and send a http request to the network camera.

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://128.39.141.213/axis-cgi/com/ptz.cgi?camera=1&move=right");

request.PreAuthenticate = true;
request.Credentials = new NetworkCredential("root","pass");

HttpWebResponse response = (HttpWebResponse)request.GetResponse();

Can anyone help?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.