I try to insert a authentification in webview2, but I have a error in my code.
The error is at the AddHandler WebAccount.CoreWebView2.BasicAuthenticationRequested :
System.NullReferenceException: 'Object reference not set to an instance of an object.'
Here my code:
Class MainWindow
Private Site As String = "https://test.fr"
Private HTTPS_LoginOne As String = "admin"
Private HTTPS_PwdOne As String = "1234567"
Public Event BasicAuthenticationRequested As EventHandler(Of CoreWebView2BasicAuthenticationRequestedEventArgs)
Public Sub New()
    InitializeComponent()
    InitWeb()
    AddHandler WebAccount.CoreWebView2.BasicAuthenticationRequested, AddressOf Authentweb
End Sub
Private Sub Authentweb(sender As Object, e As CoreWebView2BasicAuthenticationRequestedEventArgs)
    e.Response.UserName = HTTPS_LoginOne
    e.Response.Password = HTTPS_PwdOne
End Sub
Async Sub InitWeb()
    Await WebAccount.EnsureCoreWebView2Async()
    WebAccount.CoreWebView2.Navigate(Site)
End Sub
Someone have any idea ?
 
    