Solved

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

Posted on 2004-04-03
8
674 Views
Last Modified: 2013-11-20
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
Comment
Question by:Shake29
8 Comments
 
LVL 48

Expert Comment

by:AlexFM
Comment Utility
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
 

Author Comment

by:Shake29
Comment Utility
How do i change the subject area
I don't see the option anywhere
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
Comment Utility
Post a request to move the question in the support area (link at the top of the page).
0
 
LVL 48

Expert Comment

by:AlexFM
Comment Utility
You may open 20-poins question in WEB area with link to this question.
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:Shake29
Comment Utility
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
 

Author Comment

by:Shake29
Comment Utility
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
Comment Utility
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
 

Expert Comment

by:ChidigamBhanu
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

728 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

10 Experts available now in Live!

Get 1:1 Help Now