Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-04-04
4
Medium Priority
?
438 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

722 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