Forum Discussion

Srinivasan_Reng's avatar
Srinivasan_Reng
Icon for Nimbostratus rankNimbostratus
Aug 16, 2005

Connecting to BIP IP and testing

Hello

 

 

Can anyone help me please.

 

 

I have problem in connecting my devices to BigIP

 

 

Devices Connected

 

=================

 

 

The Big IP, PC and my laptop are connected.

 

I developed a small windows application (using C)based on the Video demo.

 

 

Url :

 

=====

 

http://devcentral.f5.com/Default.aspx?TabID=29&newsType=ArticleView&articleId=19

 

 

The code is pretty much the same as the above and I fine tuned a little bit.

 

 

When I compile it is fine. It Opens the dialog( asking for Hostname, Username and Password).I provided the same.

 

 

I am unable to get the list of nodes in the checkbox when i click the Button.

 

 

Error:

 

=====

 

 

“The request failed with HTTP status 404: Not Found. Access Denied”

 

What could be possible problems kindly let me know.

 

 

Here is the complete code:

 

===========================

 

 

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Security.Cryptography.X509Certificates;
namespace LocalLB
{
public class Form1 : System.Windows.Forms.Form, System.Net.ICertificatePolicy 
  {
        private System.Windows.Forms.Label lbl_Hostname;
private System.Windows.Forms.TextBox tb_hostname;
private System.Windows.Forms.CheckedListBox lb_nodes;
private System.Windows.Forms.Button b_getlist;
private System.Windows.Forms.TextBox tb_username;
private System.Windows.Forms.TextBox tb_password;
private System.Windows.Forms.Label Username;
private System.Windows.Forms.Label password;
WindowsApplication1.Node.ITCMLocalLBNode node = new  
            WindowsApplication1.Node.ITCMLocalLBNode();
System.Net.NetworkCredential creds = new 
            System.Net.NetworkCredential();
      private void InitializeComponent()
{
this.lbl_Hostname = new System.Windows.Forms.Label();
this.tb_hostname = new System.Windows.Forms.TextBox();
this.lb_nodes = new System.Windows.Forms.CheckedListBox();
this.b_getlist = new System.Windows.Forms.Button();
this.tb_username = new System.Windows.Forms.TextBox();
this.tb_password = new System.Windows.Forms.TextBox();
this.Username = new System.Windows.Forms.Label();
this.password = new System.Windows.Forms.Label();
this.SuspendLayout();
this.lbl_Hostname.Location = new System.Drawing.Point(16, 56);
this.lbl_Hostname.Name = "lbl_Hostname";
this.lbl_Hostname.TabIndex = 0;
this.lbl_Hostname.Text = "HostName";
// 
// tb_hostname
// 
this.tb_hostname.Location = new System.Drawing.Point(128, 56);
this.tb_hostname.Name = "tb_hostname";
this.tb_hostname.TabIndex = 1;
this.tb_hostname.Text = "";
// 
// lb_nodes
// 
this.lb_nodes.Location = new System.Drawing.Point(8, 160);
this.lb_nodes.Name = "lb_nodes";
this.lb_nodes.Size = new System.Drawing.Size(120, 94);
this.lb_nodes.TabIndex = 2;
// 
// b_getlist
// 
this.b_getlist.Location = new System.Drawing.Point(248, 88);
this.b_getlist.Name = "b_getlist";
this.b_getlist.TabIndex = 3;
this.b_getlist.Text = "Get_List";
this.b_getlist.Click += new System.EventHandler
            (this.b_getlist_Click);
// 
// tb_username
// 
this.tb_username.Location = new System.Drawing.Point(128, 88);
this.tb_username.Name = "tb_username";
this.tb_username.TabIndex = 4;
this.tb_username.Text = "";
// 
// tb_password
// 
this.tb_password.Location = new System.Drawing.Point(128, 120);
this.tb_password.Name = "tb_password";
this.tb_password.TabIndex = 5;
this.tb_password.Text = "";
// 
// Username
// 
this.Username.Location = new System.Drawing.Point(16, 88);
this.Username.Name = "Username";
this.Username.TabIndex = 6;
this.Username.Text = "UserName";
// 
// password
// 
this.password.Location = new System.Drawing.Point(16, 120);
this.password.Name = "password";
this.password.TabIndex = 7;
this.password.Text = "Password";
// 
// Form1
// 
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(488, 266);
this.Controls.Add(this.password);
this.Controls.Add(this.Username);
this.Controls.Add(this.tb_password);
this.Controls.Add(this.tb_username);
this.Controls.Add(this.b_getlist);
this.Controls.Add(this.lb_nodes);
this.Controls.Add(this.tb_hostname);
this.Controls.Add(this.lbl_Hostname);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
/// 
/// Required designer variable.
/// 
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
    System.Net.ServicePointManager.CertificatePolicy = this;
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// 
/// Clean up any resources being used.
/// 
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null) 
{
components.Dispose();
}
}
base.Dispose( disposing );
}
region Windows Form Designer generated code
/// 
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// 
endregion
/// 
/// The main entry point for the application.
/// 
[STAThread]
static void Main() 
{
Application.Run(new Form1());
}
//private string sHostName = "";
private string sPort = "";
private string Url;
/*void updateConnectionInfo()
{
string sProtocol = "https";
if ( sPort.Equals("80") || sPort.Equals("8080") )
{
sProtocol = "http";
}
Url = sProtocol + "://" + sHostName + ":" + sPort + "/iControl/iControlPortal.cgi";
}*/
private void b_getlist_Click(object sender, System.EventArgs e)
{
creds.UserName = tb_username.Text;
creds.Password = tb_password.Text;
node.PreAuthenticate =true;
lb_nodes.Items.Clear();
WindowsApplication1.Node.ITCMCommonIPPortDefinition [] node_defs = null;
sPort = "80";
string sProtocol = "https";
if ( sPort.Equals("80") || sPort.Equals("8080") )
{
sProtocol = "http";
}
Url = sProtocol + "://" + tb_hostname.Text + ":" + sPort + "/iControl/iControlPortal.cgi";
try
{
node.Url = Url;
node.Credentials = creds;
node_defs = node.get_node_server_list();
}
catch( Exception ex )
{
Console.Write( ex.Message );
}
int [] state = node.get_state_ex(node_defs);
for(int i=0; i{
lb_nodes.Items.Add(node_defs.address + ":" + 
                node_defs.port.ToString(),
                     
                Convert.ToBoolean(state));
}
}
private void Form1_Load(object sender, System.EventArgs e)
{
}
public bool CheckValidationResult(System.Net.ServicePoint srvPoint, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Net.WebRequest request, int certificateProblem)
{
return true;
}
}
}
// The End //

 

4 Replies

  • First thing: have you tested out any of the included sample C applications in the SDK? I'd try to compile them first to make sure that connection to your BIG-IP and authentication is correct.

     

     

    Now, looking at your code, your issue is most likely the formation of your url:

     

     

    sPort = "80";
    string sProtocol = "https";
    if ( sPort.Equals("80") || sPort.Equals("8080") )
    {
    sProtocol = "http";
    }
    Url = sProtocol + "://" + tb_hostname.Text + ":" + sPort + "/iControl/iControlPortal.cgi";

     

     

    The BIG-IP by default does not have unencrypted traffic enabled. All management connections are performed over the SSL port 443. If you change the hardcoded "sPort" to 443, you should be set.

     

     

    What's odd is that you shouldn't be getting a 404 error for this though...

     

     

    Change the connection to be encrypted and see if that fixes your issue.

     

     

    I'll try to compile the code when I get into the office in the morning and see if anything else pops out at me.

     

     

    -Joe
  • I tried this :

     

     

    sPort = "443";

     

    string sProtocol = "https";

     

    if ( sPort.Equals("80") || sPort.Equals("8080") )

     

    {

     

    sProtocol = "http";

     

    }

     

    Url = sProtocol + "://" + tb_hostname.Text + ":" + sPort + "/iControl/iControlPortal.cgi";

     

     

    Now this is the message i got when i move the mouse to :

     

     

    catch( Exception ex )

     

     

    Underlying connection was closed. Could not establish Secure Channel for SSL/TLS.

     

     

     

    I have few samples in the soap\sdk for Version 9.0. I took those samples that talks about VSSTAT/POOL and nodes.

     

     

    I just compiled the same and had a look on each thing, before my BigIP was setup.

     

     

    If the above problem is solved, i will be glad...

     

     

    I hope you have my full source code...

     

    Thank you...

     

     

    Srini

     

  • I got connected to BigIP. Thanks.

     

     

    The hostname was wrongly provided. That's why..

     

     

    Thanks Joe for all your support...
  • Are you sure you are connecting to the BIG-IP management port with your tb_hostname value? The ending URL should be something like this:

     

     

    https://bigip_mgmt_address:443/iControl/iControlPortal.cgi

     

     

    (* the :443 is optional)

     

     

    From your reply, you said you compiled the sample apps from the SDK but you didn't say you tested them to see if they worked. Did you try any of them out?

     

     

    From your error message, it looks like you aren't connecting to the correct management port. The "could not establish a secure channel" message implies that the address you are connecting to isn't setup for SSL which is the default setup for the BIG-IP management port.

     

     

    Here is how I would proceed:

     

     

    1) First check if you can connect to your url via a browser with the credentials you give. If you successfully get in you should get a page of links to all available Services that the iControl portal serves up. If this doesn't work, then there is something wrong with your BIG-IP configuration.

     

     

    2) If you can get through with the browser, then make sure that the url that you test with the browser matches what your app is trying to use via the debugger, a message box, or whatever.

     

     

    -Joe