SVN-Revision: r836
This commit is contained in:
wyf
2025-07-04 02:34:53 +00:00
parent 711218bd09
commit 8ca20e6211
2 changed files with 57 additions and 6 deletions
+30 -4
View File
@@ -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<string> qpLS = new List<string>();
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],
+27 -2
View File
@@ -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<string> qpLS = new List<string>();
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],