Forum Discussion
Chris_Bingham_1
Nimbostratus
May 19, 2005New Kid Needs Help(My First iControl VB.NET)
Greeting All!
I am getting the following error when tyring to connect with a simple VB.NET iControl App.
An unhandled exception of type 'System.Net.WebException' occurred in system.web.services.dll
Additional information: The request failed with HTTP status 400: Bad Request.
I just tried to copy Joe's example in the .NET sample video (well I used vb instead of c). What am I doing wrong? Please Help!
My Code:
Imports System
Imports System.Net
Imports System.Security
Imports System.Security.Cryptography.X509Certificates
Public Class Form1
Inherits System.Windows.Forms.Form
Region " Windows Form Designer generated code "....
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
System.Net.ServicePointManager.CertificatePolicy = New trustedCertificatePolicy
End Sub
Private Sub btnGetNodes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetNodes.Click
Dim myNode As New Node.ITCMLocalLBNode
Dim myCred As New System.Net.NetworkCredential
If Hostname.Text = "" Then
MsgBox("No Hostname Listed", MsgBoxStyle.Critical, "Error")
Exit Sub
End If
' URL to BigIP
myNode.Url = "https://" & Hostname.Text & ":" & 443 & "/iControl/iControlPortal.cgi"
Debug.WriteLine(myNode.Url)
' Turn on pre Auth?
myNode.PreAuthenticate = True
' Credentials to connect (In Production we should use read only)
myCred.UserName = Username.Text
myCred.Password = Password.Text
' Pass credentials to the BigIP
myNode.Credentials = myCred
' Empty the NodeList
NodeList.Items.Clear()
' Get List of Nodes
Dim myNodeDefs() As Node.ITCMCommonIPPortDefinition
myNodeDefs = myNode.get_node_server_list
Dim myNodeStat() As Integer
myNodeStat = myNode.get_state_ex(myNodeDefs)
Dim i As Integer
For i = 0 To myNodeDefs.Length
NodeList.Items.Add(myNodeDefs(i).address & ":" & myNodeDefs(i).port, Convert.ToBoolean(myNodeStat(i)))
Console.WriteLine(myNodeDefs(i).address)
Next
End Sub
Public Class trustedCertificatePolicy
Implements ICertificatePolicy
Public Function CheckValidationResult( _
ByVal srvPoint As System.Net.ServicePoint, _
ByVal certificate As System.Security.Cryptography.X509Certificates.X509Certificate, _
ByVal request As System.Net.WebRequest, _
ByVal certificateProblem As Integer _
) As Boolean Implements System.Net.ICertificatePolicy.CheckValidationResult
Return True
End Function
Public Function CheckValidationResult( _
ByVal srvPoint As System.Net.ServicePoint, _
ByVal certificate As System.Security.Cryptography.X509Certificates.X509Certificate, _
ByVal request As System.Net.WebRequest, _
ByVal certificateProblem As Integer _
) As Boolean Implements System.Net.ICertificatePolicy.CheckValidationResult
Return True
End Function
End Class
End Class
- Chris_Bingham_1
Nimbostratus
Excellent! Thanks for the follow up. I will send my video suggestions shortly. - Great, we'll be waiting for the suggestions.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects