Link to home
Start Free TrialLog in
Avatar of NotJeff
NotJeff

asked on

CWebControl PostData

I'm using the following code in a VC++5.0(no patches applied), IE4.01
configuration and postData is not working.  The web browser control
navigates to the url I give it, but it's method is GET and it doesn't send
my postData.  When PostData is not NULL it's supposed to send a
request method of POST and send the data.

Also I sent a breakpoint in BeforeNavigate2() and read the PostData string
it's empty!

Here is the code snippet from my app.

void CMyView::SetNavigationLocation(CString url, CString postData)
{
    //    url = "http://www.ecst.csuchico.edu/~jschlich/Flyfish/fishinfotest.cgi";
   //    postData = "userid=tim_z&pass=dont_you_wish";

    CString header;
    // Content-Type: application/x-www-form-urlencoded\r\n
    header.LoadString(IDS_FORM_URLENCODED);

    COleVariant oleVariant;
    COleVariant urlOleVariant( url );
    COleVariant dataOleVariant( postData );
    COleVariant headerOleVariant( header );

    m_WebBrowser.Navigate2(&urlOleVariant, &oleVariant, &oleVariant, &dataOleVariant, &headerOleVariant);
}

This problem has got me at a complete stand still.  If anyone can help, I will be very
very grateful and acknowledge you as the MFC WebBrowser guru!

Jeff
ASKER CERTIFIED SOLUTION
Avatar of chensu
chensu
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NotJeff
NotJeff

ASKER

I hereby hail chensu as the web control master!  And at the same time I'd like to poop on Microsofts documentation of this function.  Everything works great now!  Send me an email at the root url in my sample and I'll buy you lunch.  Thanks  NotJeff