Retrieve cookie information from Active X Microsoft Web Browser

  • Thread starter Thread starter A Cpp Dev
  • Start date Start date
A

A Cpp Dev

Guest
Hi

I have created a sample dialog based application in MFC that contains Active X control(Microsoft Web browser). I am able to navigate to the specified URL. I want to "Sign In" to this URL and after that I want to retrieve the Cookie information for making subsequent calls to my webservice. Upon successful sign in, the browser control has to be disappear. If the cookie is no longer active then the web browser should open up and ask for login.

Steps followed:

1. Created a dialog based application.

2. Right click and select Insert Active X control. Choose Microsoft Web Browser and click OK.

3. Right click on the browser and add a class - named it as CMyExplorer1(MyExplorer1.h/.cpp) files generated.

4. Right click on the browser and add a variable - named it as "m_MyBrower" in my Dialog class.

5. Added events for the browser in dialog class - BeforeNavigate2, DocumentComplete, NavigateComplete2.

6. Navigated to my URL in Dialog class OnInitDialog() method

m_MyBrowser.Navigate("https://myurl.com", NULL, NULL, NULL, NULL);

I am able to see the web page in my browser control and it is asking for login information. So far good here.

7. I want to login in this page and retrieve the cookie information so that I can make calls using this cookie to my web service. Can someone suggest me how to retrieve the cookie information in this scenario.


Thanks.

Continue reading...
 
Back
Top