MSDN > 論壇首頁 > Windows Presentation Foundation (WPF) > Passing the Credentials/SessionId to a WPF Frame Control
發問發問
 

已答覆Passing the Credentials/SessionId to a WPF Frame Control

  • 2008年8月4日 下午 01:13Swathi Rao 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    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.

解答

  • 2008年8月5日 下午 09:10Chango V. - MSFT 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     已答覆
    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.
    • 已標示為解答Marco Zhou 2008年8月8日 上午 10:13
    •  

所有回覆

  • 2008年8月5日 下午 09:10Chango V. - MSFT 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     已答覆
    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.
    • 已標示為解答Marco Zhou 2008年8月8日 上午 10:13
    •  
  • 2008年8月11日 下午 01:57Swathi Rao 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    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.


    • 已編輯Swathi Rao 2008年8月11日 下午 02:00Added a question
    •  
  • 2008年10月7日 下午 10:23jmyczek 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    I am trying to do the same thing to log on to a web server that uses digest authentication.  Did you find a solution?
  • 2009年2月4日 下午 08:41Prerak Sanghvi 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    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.
  • 2009年7月3日 下午 06:44Dhiogo 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    How can I do that??

    regards
    Dhiogo Brustolin