logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
tom0101  
#1 Posted : Thursday, April 1, 2021 7:46:39 PM(UTC)
tom0101

Rank: Newbie

Groups: Registered
Joined: 11/17/2020(UTC)
Posts: 5
Austria
Location: Villach

Thanks: 4 times
Hi all,

i use this script to control the PTZ API of my AXIS Cameras.
e.g.: http://192.168.4.111/axis-cgi/com/ptz.cgi?rpan=-2

The Script looks like this (thanks kgoodyer):
Quote:

Dim webStream As Stream
Dim webResponse = ""
Dim req As HttpWebRequest
Dim res As HttpWebResponse
req = CType(WebRequest.Create("http://192.168.4.111/axis-cgi/com/ptz.cgi?rpan=-2"), HttpWebRequest)
res = CType(req.GetResponse(), HttpWebResponse)
webStream = res.GetResponseStream() ' Get Response
Dim webStreamReader As New StreamReader(webStream)
While webStreamReader.Peek >= 0
webResponse = webStreamReader.ReadToEnd()
End While


The Problem is, i don't know how to do a request with a password,
Quote:
http://USER:PASSWORT@192.168.4.111/axis-cgi/com/ptz.cgi?rpan=-2
does not work.

So is there a possibility to send user and password with a HttpWebRequest?

Best, Thomas
kross  
#2 Posted : Friday, April 2, 2021 7:56:19 AM(UTC)
kross

Rank: Advanced Member

Groups: Registered
Joined: 10/31/2020(UTC)
Posts: 67
United States

Was thanked: 12 time(s) in 12 post(s)
I don't have an Axis camera, but I did some searching, and it appears Axis cameras require Digest authentication.

Here's a C# example, it should be easy enough to translate to VB.Net

https://stickler.de/en/i...-authentication-c-csharp
tom0101  
#3 Posted : Wednesday, April 7, 2021 9:16:51 PM(UTC)
tom0101

Rank: Newbie

Groups: Registered
Joined: 11/17/2020(UTC)
Posts: 5
Austria
Location: Villach

Thanks: 4 times
Thank you for the answer, but unfortunately i am not able to translate the c# example to VB.Net.

Maybe anyone can do?

Thanks,
Tom
kross  
#4 Posted : Thursday, April 8, 2021 4:45:43 AM(UTC)
kross

Rank: Advanced Member

Groups: Registered
Joined: 10/31/2020(UTC)
Posts: 67
United States

Was thanked: 12 time(s) in 12 post(s)
I'm a C++ and C# software engineer, but I don't work with VB.Net. So here's a stab by me, completely untested, I don't even know if it would compile.



Quote:

Dim webStream As Stream
Dim webResponse = ""
Dim req As HttpWebRequest
Dim res As HttpWebResponse

Dim uri as New Uri("http://192.168.4.111/axis-cgi/com/ptz.cgi?rpan=-2")
Dim username as String = "PutYourUsernameHere"
Dim password as String = "PutYourPasswordHere"

req = CType(WebRequest.Create(uri), HttpWebRequest)

Dim myNetworkCredential As New NetworkCredential(username, password)

Dim myCredentialCache As New CredentialCache
myCredentialCache.Add(uri, "Digest", myNetworkCredential)

req.PreAuthenticate = true
req.Credentials = myCredentialCache

res = CType(req.GetResponse(), HttpWebResponse)
webStream = res.GetResponseStream() ' Get Response
Dim webStreamReader As New StreamReader(webStream)
While webStreamReader.Peek >= 0
webResponse = webStreamReader.ReadToEnd()
End While



If there are syntax or compile errors, someone who actually knows VB.Net will have to take a look at it.

Hope this helps!
-- Kevin
tom0101  
#5 Posted : Friday, April 23, 2021 5:46:49 PM(UTC)
tom0101

Rank: Newbie

Groups: Registered
Joined: 11/17/2020(UTC)
Posts: 5
Austria
Location: Villach

Thanks: 4 times
I still couldn't get it working.

Anyone else who knows how to get this done in VB.Net?

Whisnant4154  
#6 Posted : Thursday, May 6, 2021 3:39:50 PM(UTC)
Whisnant4154

Rank: Newbie

Groups: Registered
Joined: 5/6/2021(UTC)
Posts: 1
United States
Location: New York

Jenkins provides machine-consumable remote access API to its functionalities. Currently trigger a new build In order to make this command work, you need to configure your Jenkins job to take a file in environments where XML manipulation is tedious (such as shell script.) Username/password based authentication.

mygiftcardsite
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.