?
Solved

Supplying Basic Authentication during HTTP request in VB6

Posted on 2008-11-17
2
Medium Priority
?
1,183 Views
Last Modified: 2013-11-25
I'm trying to use VB6 to set and unset a privacy mode on a Panasonic BL-C111 IP Camera. This cgi function requires administrator credentials to be supplied. You cannot do this in IE, but in firefox you can use http://user:password@172.16.50.30/Set?Func=Powerdown&Kind=1&Data=0 to supply the credentials in line, any ideas how I can perform this within VB?
0
Comment
Question by:AshridgeTechServices
1 Comment
 
LVL 38

Accepted Solution

by:
PaulHews earned 2000 total points
ID: 22985491
You can use components provided by Microsoft for HTTP use in script and VB

Add a reference to Microsoft WinHTTP services:


Option Explicit
Const HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0
 
Private Sub Command1_Click()
    Dim http As WinHttpRequest
    Dim strResponse As String
    
    Set http = New WinHttpRequest
    
    http.Open "GET", "http://172.16.50.30/Set?Func=Powerdown&Kind=1&Data=0", False
    http.SetCredentials "admin", "admin", HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
    http.Send
    strResponse = http.ResponseText
    Text1.Text = strResponse
    
   
    
End Sub

Open in new window

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question