Checking-HTTP-Response-Code - WeOnlyDo Software example code



All

wodCrypt (12)
wodSSH (10)
wodSFTP (23)
wodSSHServer (1)
wodSSHTunnel (11)
wodSSHpackage
wodSFTPdll

wodSSH.NET (10)
wodSFTP.NET (24)
wodFtpDLX.NET (22)
wodWebServer.NET (10)

wodAppUpdate (13)
wodHttpDLX (8)
wodFtpDLX (22)
wodTelnetDLX
wodFTPServer (3)
wodWebServer (10)
wodVPN
wodXMPP (13)
All ** [Visual Basic] ** [C#] ** [VB.NET] **

Checking HTTP Response Code
VB code
Dim WithEvents wodHttp As wodHttpDLXCom
Private Sub Form_Load()
    ' Initialize the component
    Set wodHttp = New wodHttpDLXCom
    
    ' Now, let's get the page
    wodHttp.Get "http://www.weonlydo.com"
    
End Sub

' When component is done executing, Done event is triggered. We can
' check response here
Private Sub wodHttp_Done(ByVal ErrorCode As Long, ByVal ErrorText As String)
    ' If no Error occured, ErrorCode will return 0
    If ErrorCode = 0 Then
        MsgBox wodHttp.Response.StatusCode
    Else
        MsgBox ErrorText
    End If
End Sub
VB.Net code
Dim WithEvents wodHttp As wodHttpDLXComLib.wodHttpDLXCom
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    ' Initialize the component
    wodHttp = New wodHttpDLXComLib.wodHttpDLXCom

    ' Now, let's get the page
    wodHttp.Get("http://www.weonlydo.com")
End Sub

' When component is done executing, Done event is triggered. We can
' check response here
Private Sub wodHttp_Done(ByVal ErrorCode As Integer, ByVal ErrorText As String) Handles wodHttp.Done
    ' If no Error occured, ErrorCode will return 0
    If ErrorCode = 0 Then
        MsgBox(wodHttp.Response.StatusCode)
    Else
        MsgBox(ErrorText)
    End If
End Sub
C# code
private wodHttpDLXComLib.wodHttpDLXComClass wodHttp;
private void Form1_Load(object sender, EventArgs e)
{
    // Initialize the component and declare Done event
    wodHttp = new wodHttpDLXComLib.wodHttpDLXComClass();
    wodHttp.Done += new wodHttpDLXComLib._IwodHttpDLXComEvents_DoneEventHandler(wodHttp_Done);

    // Now, let's get the page
    wodHttp.Get("http://www.weonlydo.com");
}

// When component is done executing, Done event is triggered. We can
// check response here
void wodHttp_Done(int ErrorCode, string ErrorText)
{
    // If no Error occured, ErrorCode will return 0
    if(ErrorCode == 0)
    {
        MessageBox.Show(wodHttp.Response.StatusCode);
    }
    else
    {
        MessageBox.Show(ErrorText);
    }
}