diff --git a/插件库/Lskj.Control/FrmWebBrowser.cs b/插件库/Lskj.Control/FrmWebBrowser.cs index 176411a..0f94946 100644 --- a/插件库/Lskj.Control/FrmWebBrowser.cs +++ b/插件库/Lskj.Control/FrmWebBrowser.cs @@ -19,6 +19,9 @@ using Lskj.Control; using Xilium.CefGlue; using Lskj.Control.BrowserSetting; using System.Net; +using System.Collections; +using System.Linq; +using Lskj.Web.Core.Util; namespace Lskj.Control { @@ -43,10 +46,11 @@ namespace Lskj.Control cefWindowInfo.SetAsChild(this.Handle, new CefRectangle(0, 0, this.Width, this.Height)); var bsClient = new BsClient(RightKeyFlag); bsClient.frmWebBrowser = this; + bsClient.OnCreated += bsClient_OnCreated; var cefBrowserSettings = new CefBrowserSettings(); //Url = "https://ie.icoa.cn/"; - CefBrowserHost.CreateBrowser(cefWindowInfo, bsClient, cefBrowserSettings, url); + CefBrowserHost.CreateBrowser(cefWindowInfo, bsClient, cefBrowserSettings, ToEnUrl(url)); //清除所有Cookie var cookieManager = CefCookieManager.GetGlobal(null); cookieManager.DeleteCookies("", "", null); @@ -76,7 +80,7 @@ namespace Lskj.Control { if (cefBrowserSettings != null) { - cefBrowserSettings.GetMainFrame().LoadUrl(url); + cefBrowserSettings.GetMainFrame().LoadUrl(ToEnUrl(url)); } } public void LoadRequest(string url, string dataStr) @@ -90,5 +94,27 @@ namespace Lskj.Control cefBrowserSettings.GetMainFrame().LoadUrl(webResponse.ResponseUri.AbsoluteUri); } } - } -} + public static string ToEnUrl(string url) + { + string[] urlParams = url.Split('?'); + string enKey = "encrypt", enVal = ""; + bool hasEn = false; + if (urlParams.Length > 1) + { + string[] queryParams = urlParams[1].Split('&'); + List qpLS = new List(); + Hashtable pms = new Hashtable(); + hasEn = queryParams.Any(str => str.Trim().StartsWith(enKey, StringComparison.OrdinalIgnoreCase)); + foreach (string q in queryParams) + { + string[] eqParams = q.Split('='); + if (eqParams.Length > 1) + { + if (hasEn && eqParams[0].ToLower() == enKey) + { + enVal = eqParams[1]; + continue; + } + if (hasEn || eqParams[0].ToLower() == "username" || eqParams[0].ToLower() == "password") + { + pms.Add(eqParams[0], \ No newline at end of file diff --git a/插件库/Lskj.Control/FrmWebBrowser2.cs b/插件库/Lskj.Control/FrmWebBrowser2.cs index 2290072..7677d79 100644 --- a/插件库/Lskj.Control/FrmWebBrowser2.cs +++ b/插件库/Lskj.Control/FrmWebBrowser2.cs @@ -19,6 +19,9 @@ using Lskj.Control; using Xilium.CefGlue; using Lskj.Control.BrowserSetting2; using System.Net; +using System.Collections; +using Lskj.Web.Core.Util; +using System.Linq; namespace Lskj.Control { @@ -95,5 +98,27 @@ namespace Lskj.Control cefBrowserSettings.GetMainFrame().LoadUrl(webResponse.ResponseUri.AbsoluteUri); } } - } -} + public static string ToEnUrl(string url) + { + string[] urlParams = url.Split('?'); + string enKey = "encrypt", enVal = ""; + bool hasEn = false; + if (urlParams.Length > 1) + { + string[] queryParams = urlParams[1].Split('&'); + List qpLS = new List(); + Hashtable pms = new Hashtable(); + hasEn = queryParams.Any(str => str.Trim().StartsWith(enKey, StringComparison.OrdinalIgnoreCase)); + foreach (string q in queryParams) + { + string[] eqParams = q.Split('='); + if (eqParams.Length > 1) + { + if (hasEn && eqParams[0].ToLower() == enKey) + { + enVal = eqParams[1]; + continue; + } + if (hasEn || eqParams[0].ToLower() == "username" || eqParams[0].ToLower() == "password") + { + pms.Add(eqParams[0], \ No newline at end of file