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
Solved

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

Posted on 2004-04-04
4
434 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
stop navigation from wrapping 7 91
Wordpress "chart" plugin recommendation 7 58
show form submit button based on jquery sum 5 44
Two wordpress questions 3 61
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

808 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