Solved

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

Posted on 2004-04-03
8
688 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
ID: 10750872
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
ID: 10751614
How do i change the subject area
I don't see the option anywhere
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10751653
Post a request to move the question in the support area (link at the top of the page).
0
Independent Software Vendors: 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!

 
LVL 48

Expert Comment

by:AlexFM
ID: 10751703
You may open 20-poins question in WEB area with link to this question.
0
 

Author Comment

by:Shake29
ID: 10753508
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
ID: 10754751
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: 10754965
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
ID: 23836679
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to create frequencies of a variable from SAS dataset? 10 137
notReplace  challenge 53 151
abstract class with all non abstract mentods 6 84
Problem to open Excel file 15 215
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

685 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