Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 712
  • Last Modified:

Persistence of cookies and authentication tickets when CHtmlView launches new IE browser windows

My clients must be authenticated with a .NET authentication ticket or cookie that persists over all browser windows.  It works correctly if I start the web application in Internet Explorer.  The authentication ticket will persist over any new window that is launched by a script on the page.

But if the user logs on from a page running in a CHtmlView, and then when the page launches a new IE browser window, the user is not authenticated in the new window and must log on in that new window.

Why is this so?  What must i do?
0
Shake29
Asked:
Shake29
1 Solution
 
AlexFMCommented:
I think you have a best chance to get answer in WEB development area. My guess is that IE security level should be reduced. However, you can get a good advice about cookies and authentication from WEB developers.
0
 
Shake29Author Commented:
How do i change the subject area
I don't see the option anywhere
0
 
Karl Heinz KremerCommented:
Post a request to move the question in the support area (link at the top of the page).
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
AlexFMCommented:
You may open 20-poins question in WEB area with link to this question.
0
 
Shake29Author Commented:
CHtmlView is hosting the Internet Explorer ActiveX control.

The only difference I see so far between the ActiveX control and Internet Explorer is that authentication cookies don't persist between the Internet Exporer ActiveX control and a new Internet Explorer browser window.

And i believe it is a matter of having to override some implementation so that the ActiveX control shares the authentication cookie with the new Internet Explorer browser window.  But i don't know, hence why i'm here and in the MFC subject area.
0
 
Shake29Author Commented:
I will be closing this question, for I have solved the problem.

I have overrided the OnNewWindow2 event of CHtmlView.
In the event, i create a new document window, and the authentication ticket persists.
0
 
NetminderCommented:
User resolved; points (250) refunded and question closed.

Solution posted in http://www.experts-exchange.com/Q_20943403.html is below.

Netminder
Site Admin

========

Solution:
I overrided the OnNewWindow2 event and created a new document frame having the same parent application....

void CBrowserView::OnNewWindow2(LPDISPATCH* ppDisp, BOOL* Cancel)
{
    // Get a pointer to the application object
    CWinApp* pApp = AfxGetApp();    // Get the correct document template
   
     CDocTemplate* pDocTemplate;
    POSITION pos = pApp->GetFirstDocTemplatePosition();
    pDocTemplate = pApp->GetNextDocTemplate(pos);
    ASSERT(pDocTemplate);    // Create the new frame

    CFrameWnd* pNewFrame = pDocTemplate->CreateNewFrame(GetDocument(),
                                   (CFrameWnd*)AfxGetMainWnd());
    ASSERT(pNewFrame);    // Activate the frame and set its active view
     pDocTemplate->InitialUpdateFrame(pNewFrame, NULL);

    CBrowserView* pWBVw = (CBrowserView*)pNewFrame->GetActiveView();
    ASSERT(pWBVw);
    pWBVw->SetRegisterAsBrowser(TRUE);
     *ppDisp = pWBVw->GetApplication();
}
0
 
ChidigamBhanuCommented:
I need use in a seperate Dialog, i cannot use same browser as a  new window. Can any one kindly suggest me how can i fix this problem.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now