简体   繁体   English

Web浏览器控件的行为不同于IE c#

[英]webbrowser control acts different than IE c#

So I've got my WebBrowser application which is constantly accessing website to do some stuff.. The problem is at some point this website is starting to be unavailable to my WebBrowser but I can still access it from IE. 因此,我有了WebBrowser应用程序,该应用程序正在不断访问网站以执行某些操作。.问题是在某些时候该网站对我的WebBrowser来说不可用,但我仍然可以从IE访问它。 It is related to some punishment from this website's "security algorithms?", but I wonder why I can access it with IE while my WebBrowser is "banned"? 这与该网站的“安全算法”受到一些惩罚有关,但是我想知道为什么在我的WebBrowser被“禁止”时可以使用IE访问它吗? I tried to clear cache, cookies(programatically), change my IP by HideMyAss or TunnelBear but no results. 我试图清除缓存,cookie(以编程方式),通过HideMyAss或TunnelBear更改IP,但没有结果。 I've also forced my WebBrowser to use the latest IE version. 我还强迫WebBrowser使用最新的IE版本。 Results are I can't visit this website for some time via my webbrowser, but I can via IE.. 结果是我无法通过Web浏览器访问此网站一段时间,但可以通过IE浏览。

        int BrowserVer, RegVal;

        using (WebBrowser Wb = new WebBrowser())
            BrowserVer = Wb.Version.Major;

        // set the appropriate IE version
        if (BrowserVer >= 11)
            RegVal = 11001;
        else if (BrowserVer == 10)
            RegVal = 10001;
        else if (BrowserVer == 9)
            RegVal = 9999;
        else if (BrowserVer == 8)
            RegVal = 8888;
        else
            RegVal = 7000;

        // set the actual key
        using (RegistryKey Key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", RegistryKeyPermissionCheck.ReadWriteSubTree))
            if (Key.GetValue(System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".exe") == null)
                Key.SetValue(System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".exe", RegVal, RegistryValueKind.DWord);

How this website recognizes my webbrowser control? 该网站如何识别我的Web浏览器控件? Is it anything more that I can clear/dispose to be not recognized? 我还能清除/处置不被识别的东西吗?

How this website recognizes my webbrowser control? 该网站如何识别我的Web浏览器控件? Is it anything more that I can clear/dispose to be not recognized? 我还能清除/处置不被识别的东西吗?

You could check the HTTP request when using IE and browser control access the website, and compare the request URL to check whether it append a query string to the URL. 您可以在使用IE和浏览器控件访问网站时检查HTTP请求,并比较请求URL以检查是否将查询字符串附加到URL。

Besides, you could also refer to this thread and check whether it's using property to detect if web page opened from WebBrowser control. 此外,您还可以引用该线程并检查它是否使用属性来检测是否从WebBrowser控件打开了网页。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM