none
How to HTTPS authorization? RRS feed

  • Question

  • How to post data in HTTPS authorization in VB.NET?

    How to get headers(cookies), get html code and set headers(cookies) in HTTPS?

    This is code return HTML code (GET metod):

     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim strRemoteHost As String
        Dim strURLPath As String
        Dim RemotePort As Integer
    
    
        strRemoteHost = "https://addons.mozilla.org"
        strURLPath = "/en-US/firefox/users/login/index.asp"
        RemotePort = 443
        AxInet1.RemotePort = RemotePort
        AxInet1.Protocol = InetCtlsObjects.ProtocolConstants.icHTTPS
        AxInet1.RemoteHost = strRemoteHost
     
        MsgBox(AxInet1.OpenURL(strRemoteHost & strURLPath, dataType:=False))
    
      End Sub

    Sunday, July 4, 2010 6:12 PM

Answers

  • Hi,

    First of all I don't recognize what AxInet1 is??? So you might need to provide more information about it, and how your want to use it, what purpost do you have to use it?

    How to send data (metod post) in vb?

    How to get response in vb?

    I recommend you to use HttpWebRequest to do so:

        Dim fr As System.Net.HttpWebRequest
            Dim targetURI As New Uri("https://weblogs.asp.net/farazshahkhan")
            fr = DirectCast(System.Net.HttpWebRequest.Create(targetURI), System.Net.HttpWebRequest)
            fr.Method = "Post"
            fr.ContentType = "application/x-www-form-urlencoded"
        fr.CookieContainer = New CookieContainer()
            'In the above code http://weblogs.asp.net/farazshahkhan is used as an example      
            'it can be a different domain with a different filename and extension    
            If (fr.GetResponse().ContentLength > 0) Then
                Dim str As New System.IO.StreamReader(fr.GetResponse().GetResponseStream())
                Response.Write(str.ReadToEnd())
         str.Close();       
            End If

     Thanks

    Binze


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Bin-ze Zhao Friday, July 9, 2010 3:20 AM
    Wednesday, July 7, 2010 8:46 AM

All replies

  • Please help.

    HTTPS

    How to send data (metod post) in vb?

    How to get response in vb?

    Monday, July 5, 2010 2:28 PM
  • Hi,

    First of all I don't recognize what AxInet1 is??? So you might need to provide more information about it, and how your want to use it, what purpost do you have to use it?

    How to send data (metod post) in vb?

    How to get response in vb?

    I recommend you to use HttpWebRequest to do so:

        Dim fr As System.Net.HttpWebRequest
            Dim targetURI As New Uri("https://weblogs.asp.net/farazshahkhan")
            fr = DirectCast(System.Net.HttpWebRequest.Create(targetURI), System.Net.HttpWebRequest)
            fr.Method = "Post"
            fr.ContentType = "application/x-www-form-urlencoded"
        fr.CookieContainer = New CookieContainer()
            'In the above code http://weblogs.asp.net/farazshahkhan is used as an example      
            'it can be a different domain with a different filename and extension    
            If (fr.GetResponse().ContentLength > 0) Then
                Dim str As New System.IO.StreamReader(fr.GetResponse().GetResponseStream())
                Response.Write(str.ReadToEnd())
         str.Close();       
            End If

     Thanks

    Binze


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Bin-ze Zhao Friday, July 9, 2010 3:20 AM
    Wednesday, July 7, 2010 8:46 AM