.NET Framework Developer Center > .NET Development Forums > Windows Presentation Foundation (WPF) > Passing the Credentials/SessionId to a WPF Frame Control
Ask a questionAsk a question
 

AnswerPassing the Credentials/SessionId to a WPF Frame Control

  • Monday, August 04, 2008 1:13 PMSwathi Rao Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,

    In a standalone application, I am using a WPF Frame control to display the content of a Web URL. Prior to displaying the content, I have methods that login to the server with some user credentials. When displaying the content of the WebUI Frame, I would like provide either the credentials or the session id of my web request in order to prevent it from showing me the Authentication dialog box and the dialog box to accept the server certificate.

    Could some one please suggest how one can modify the webRequest  before the Frame displays the content. I have tried to set the credentials and the session ID in the NavigatingCancelEventHandler. But that did not help either as NavigatingCancelEventArgs only provides a property to get the webrequest, and not update it.

    Regards,
    Swathi.

Answers

  • Tuesday, August 05, 2008 9:10 PMChango V. - MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    What kind of authentication does your server require - cookie-based, digest, Windows Integrated?

    You should be aware that there are two kinds of web requests involved when navigating a Frame to an HTML resource: first, a "managed" WebRequest, then the native Web Browser control's request via WinINet. The two networking stacks are generally independent, so you may have to "prime" WinINet with the authentication information too.


    This posting is provided "AS IS" with no warranties, and confers no rights.
    • Marked As Answer byMarco Zhou Friday, August 08, 2008 10:13 AM
    •  

All Replies

  • Tuesday, August 05, 2008 9:10 PMChango V. - MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    What kind of authentication does your server require - cookie-based, digest, Windows Integrated?

    You should be aware that there are two kinds of web requests involved when navigating a Frame to an HTML resource: first, a "managed" WebRequest, then the native Web Browser control's request via WinINet. The two networking stacks are generally independent, so you may have to "prime" WinINet with the authentication information too.


    This posting is provided "AS IS" with no warranties, and confers no rights.
    • Marked As Answer byMarco Zhou Friday, August 08, 2008 10:13 AM
    •  
  • Monday, August 11, 2008 1:57 PMSwathi Rao Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Chango,

    The problem is I am trying to create a Single-Sign On mechanism so that once the user is logged in from elsewhere in the application, opening the Frame control to display related data should not ask the user to sign in again. Hence I was trying to find a means to pass either the session id or the user credentials so that the Frame control can automatically authenticate the user.

    What I am still unclear about is how to modify the WebRequest used by the Frame.

    Regards,
    Swathi.


    • Edited bySwathi Rao Monday, August 11, 2008 2:00 PMAdded a question
    •  
  • Tuesday, October 07, 2008 10:23 PMjmyczek Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I am trying to do the same thing to log on to a web server that uses digest authentication.  Did you find a solution?
  • Wednesday, February 04, 2009 8:41 PMPrerak Sanghvi Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Did anyone find a solution to this issue?  I'm trying to figure out any way to pass credentials to the frame control.  In the Frame.Navigating event, I see that WebRequest is exposed in the EventArgs, but setting credential information there does not seem to work either.
  • Friday, July 03, 2009 6:44 PMDhiogo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    How can I do that??

    regards
    Dhiogo Brustolin