The webbrowser control obtains post data.

Source: Internet
Author: User

Webbrowser is actually an encapsulation of the ActiveX control shdocvw, and many underlying calls of this shdocvw webbrowser control are not provided for implementation. You need to directly operate the shdocevw Control for this application. The procedure is as follows:

1. Find the dynamic library shdocvw. dll in the Windows/system32 directory and add it to the reference.

2. Add the following statement to form1_load:

Shdocvw. webbrowser WB = (shdocvw. webbrowser) webbrowser1.activexinstance;
WB. beforenavigate2 + = new dwebbrowserevents2_beforenavigate2eventhandler (webbrowser_beforenavigate2 );
3. Add the following member functions

Private void webbrowser_beforenavigate2 (Object Pdisp, ref object URL, ref object flags,
Ref object targetframename, ref object postdata, ref object headers, ref bool cancel)
{
String postdatatext = system. Text. encoding. ASCII. getstring (postdata as byte []);
}

After completing the preceding three steps, you will respond to the beforenavigate2 event when you post data,

Postdatatext contains your post data.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.