none
How to access post data that sent by the webbrowser control?

    Question

  • How to access post data that sent by the webbrowser control? I want to sent post directly to the server using httpwebrequest but the post data is encrypted.

    I have try to use this, but does not work. The webbrowser_beforenavigate2 events not executed. I am using net framework 4.0.

    Private ie As SHDocVw.InternetExplorer
    
    Private Sub FrmWebTest_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    
            ie = DirectCast(wb.ActiveXInstance, SHDocVw.InternetExplorer)
            AddHandler ie.BeforeNavigate2, AddressOf WebBrowser_BeforeNavigate2
    
    End Sub
    
    Private Sub WebBrowser_BeforeNavigate2(ByVal pDisp As Object, ByRef URL As Object, _
           ByRef Flags As Object, ByRef TargetFrameName As Object, _
           ByRef PostData As Object, ByRef Headers As Object, ByRef Cancel As Boolean)
    
            Dim PostDataText = System.Text.Encoding.ASCII.GetString(PostData)
    
            Console.WriteLine(PostDataText)
    End Sub

    Sunday, March 12, 2017 4:04 AM

Answers

  • Hi Skypea,

    Based on your description, you wan to know how to get the post data that sent by the WebBrowser control, please refer to this case.

    Hope it is helpful to you.

    Best Regards,

    Cherry Bu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Skypea Tuesday, March 21, 2017 11:49 AM
    Tuesday, March 21, 2017 10:51 AM
    Moderator

All replies

  • Hi Skypea,

    >>How to access post data that sent by the webbrowser control? I want to sent post directly to the server using httpwebrequest but the post data is encrypted.

    Could you please provide httpwebrequest related code, which we could reproduce your issue on my side and try to find a solution to resolve it.

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, March 14, 2017 8:24 AM
    Moderator
  • Hi cole,

    Thank you for the reply.

    I want to know how to get the post data that sent by the website when I submit a form using webbrowser. Because I want to do an automation to a website using httpwebrequest but I have a problem when sending a http post request because the post data should be encrypted and I do not know the encryption method. Any solution?


    • Edited by Skypea Wednesday, March 15, 2017 4:14 AM
    Wednesday, March 15, 2017 4:14 AM
  • Hi Skypea,

    Based on your description, you wan to know how to get the post data that sent by the WebBrowser control, please refer to this case.

    Hope it is helpful to you.

    Best Regards,

    Cherry Bu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Skypea Tuesday, March 21, 2017 11:49 AM
    Tuesday, March 21, 2017 10:51 AM
    Moderator