Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Monodroid WebView加载SSL页面_C#_Ssl_Webview_Xamarin.android - Fatal编程技术网

C# Monodroid WebView加载SSL页面

C# Monodroid WebView加载SSL页面,c#,ssl,webview,xamarin.android,C#,Ssl,Webview,Xamarin.android,我尝试加载带有SSL页面的WebView,但遇到了一个错误。下面是代码和错误。我已设置允许Internet访问的权限 我认为这是一个单一的问题。当我在默认浏览器中尝试SSL网页时,它工作正常 WebView webView = new WebView(this); string website = "https://..."; webView.Settings.JavaScriptEnabled = true; webView.SetWebViewClient(new WebViewClient

我尝试加载带有SSL页面的WebView,但遇到了一个错误。下面是代码和错误。我已设置允许Internet访问的权限

我认为这是一个单一的问题。当我在默认浏览器中尝试SSL网页时,它工作正常

WebView webView = new WebView(this);
string website = "https://...";
webView.Settings.JavaScriptEnabled = true;
webView.SetWebViewClient(new WebViewClientAuthentication());
webView.LoadUrl(website);

//definition for WebViewClientAuthentication
public class WebViewClientAuthentication : WebViewClient
{
    public override void OnReceivedSslError(WebView view, SslErrorHandler handler, Android.Net.Http.SslError error)
    {
        Log.Error("SSL ERROR",string.Format("SSL ERROR: {0}, Primary: {1}", error.GetType.ToString(), error.PrimaryError.ToString()));
        base.OnReceivedSslError(view, handler, error);
    }
}
输出 SSL错误:Android.Net.Http.SslError,主:Notyetvalid

评论 我看到了这条消息:-但我不确定将SSL站点加载到webview中意味着什么。

尝试以下方法:

//definition for WebViewClientAuthentication
public class WebViewClientAuthentication : WebViewClient
{
    public override void OnReceivedSslError(WebView view, SslErrorHandler handler, Android.Net.Http.SslError error)
    {
        handler.Proceed();
    }
}

相当糟糕的UI stackoverflow-如果回答我问题的人删除了他的帐户,我的声誉就会降低。。。你至少可以把答案留在那里,把答案和“未知账户”联系起来——现在我记不起答案了,甚至连自己都记不起来了!嘿,我要了!这个问题已经解决了将近一年了,但是用户离开了SO.com,我失去了答案。。。。看看我对这个问题的评论:)确实有效,但这不应该在生产中使用。这忽略了SSL错误,这从来都不是一个好主意。谷歌会自动拒绝使用此代码的更新