Solved

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

Posted on 2004-04-04
4
431 Views
Last Modified: 2012-08-13
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?

250 points at:
http://www.experts-exchange.com/Programming/Programming_Languages/MFC/Q_20942665.html#10751703
0
Comment
Question by:Shake29
  • 2
4 Comments
 
LVL 15

Expert Comment

by:VincentPuglia
ID: 10753213
Hi,

  I may be way offbase here, but...

  CHtmlView is not executing an IE browser window.  It is simulating an IE browser through its MFC classes.  Therefore, the implication would be that all behavior is not the same.  

  I'm presuming the app is spawning a new window that knows nothing of cookies and whatever authentication you are requiring through the .NET.  So, while I know the MFC people told you to come here, I believe they are mistaken and you need write some code within the app to check for cookies before spawning the 'browser' window.

Vinny
0
 

Author Comment

by:Shake29
ID: 10754750
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
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 10754979
User resolved; points (20) refunded and question closed. Solution from http://www.experts-exchange.com/Q_20943403.html is posted 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
 
LVL 15

Expert Comment

by:VincentPuglia
ID: 10757115
Glad to see I wasn't that offbase :D

Vinny
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now