Solved

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

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

862 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

20 Experts available now in Live!

Get 1:1 Help Now