interface ICoreWebView2_10
Note
This reference is no longer being maintained. For the latest API reference, see WebView2 API Reference.
interface ICoreWebView2_10
: public ICoreWebView2_9
This interface is an extension of ICoreWebView2_9 that supports BasicAuthenticationRequested event.
Summary
Members | Descriptions |
---|---|
add_BasicAuthenticationRequested | Add an event handler for the BasicAuthenticationRequested event. |
remove_BasicAuthenticationRequested | Remove an event handler previously added with add_BasicAuthenticationRequested. |
Applies to
Product | Introduced |
---|---|
WebView2 Win32 | 1.0.1150.38 |
WebView2 Win32 Prerelease | 1.0.1133 |
Members
add_BasicAuthenticationRequested
Add an event handler for the BasicAuthenticationRequested event.
public HRESULT add_BasicAuthenticationRequested(ICoreWebView2BasicAuthenticationRequestedEventHandler * eventHandler, EventRegistrationToken * token)
BasicAuthenticationRequested event is raised when WebView encounters a Basic HTTP Authentication request as described in https://developer.mozilla.org/docs/Web/HTTP/Authentication, a Digest HTTP Authentication request as described in https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization#digest, an NTLM authentication or a Proxy Authentication request.
The host can provide a response with credentials for the authentication or cancel the request. If the host sets the Cancel property to false but does not provide either UserName or Password properties on the Response property, then WebView2 will show the default authentication challenge dialog prompt to the user.
if (auto webView10 = m_webView.try_query<ICoreWebView2_10>())
{
CHECK_FAILURE(webView10->add_BasicAuthenticationRequested(
Callback<ICoreWebView2BasicAuthenticationRequestedEventHandler>(
[this](
ICoreWebView2* sender,
ICoreWebView2BasicAuthenticationRequestedEventArgs* args) {
wil::com_ptr<ICoreWebView2BasicAuthenticationResponse> basicAuthenticationResponse;
CHECK_FAILURE(args->get_Response(&basicAuthenticationResponse));
CHECK_FAILURE(basicAuthenticationResponse->put_UserName(L"user"));
CHECK_FAILURE(basicAuthenticationResponse->put_Password(L"pass"));
return S_OK;
})
.Get(),
&m_basicAuthenticationRequestedToken));
}
else {
FeatureNotAvailable();
}
remove_BasicAuthenticationRequested
Remove an event handler previously added with add_BasicAuthenticationRequested.
public HRESULT remove_BasicAuthenticationRequested(EventRegistrationToken token)
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기