【问题标题】:WinForms WebBrowser control ignores referrerWinForms WebBrowser 控件忽略引用者
【发布时间】:2014-05-17 18:33:11
【问题描述】:

我遇到了以下问题:

var browser = new WebBrowser();
var header = "Referer: http://testref.com\r\n";
browser.Navigate("http://localhost/test", "_self", null, header");

/localhost/test 中的 index.html 包含:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"  type="text/javascript"></script>
            <script>
                $( document ).ready(function() {
                alert(document.referrer);}
</script>

它说referrer 是空的,虽然我已经指定了。 为什么,以及如何强制 .net 代码发送引用者,这将被 js 代码识别。 也许使用 3 方控件会有所帮助,例如 GeckoFx?

【问题讨论】:

    标签: c# winforms http http-headers


    【解决方案1】:

    使用 GeckoFx 代替内置控件解决了问题;

    【讨论】:

    • 很高兴听到您自己解决问题。但是你为什么不接受你自己的答案呢?
    • 因为我只能在明天接受我的回答,而这个解决方案并没有给我回答“为什么”的问题
    猜你喜欢
    • 2011-10-19
    • 1970-01-01
    • 2012-04-16
    • 1970-01-01
    • 2023-04-05
    • 1970-01-01
    • 2023-03-31
    • 1970-01-01
    • 2013-01-28
    相关资源
    最近更新 更多