MSDN >
論壇首頁
>
Windows Presentation Foundation (WPF)
>
Passing the Credentials/SessionId to a WPF Frame Control
Passing the Credentials/SessionId to a WPF Frame Control
- 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.
解答
- 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 Friday, 8 August, 2008 10:13
所有回覆
- 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 Friday, 8 August, 2008 10:13
- 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 Monday, 11 August, 2008 14:00Added a question
- I am trying to do the same thing to log on to a web server that uses digest authentication. Did you find a solution?
- 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.
- How can I do that??
regards
Dhiogo Brustolin

