geckofx如何启用cookie

时间:2017-04-12 22:26:28

标签: c# geckofx

我很好奇如何在geckofx中启用cookie,所以当我重新启动应用程序时,它会在我加载应用程序时显示cookie,所有显示的都是null这里是表单的代码看看我真的需要帮助它可能与代理有关。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Gecko;
using MaterialSkin;

namespace FoxChatBETA
{
    public partial class Form1 : MaterialSkin.Controls.MaterialForm
    {
        public Form1()
        {
            InitializeComponent();
            var materialSkinManager = MaterialSkinManager.Instance;
            materialSkinManager.AddFormToManage(this);
            materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT;
            materialSkinManager.ColorScheme = new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE);
            Xpcom.Initialize(Environment.CurrentDirectory);
            GeckoPreferences.User["plugin.state.flash"] = true;
            GeckoPreferences.User["network.cookie.thirdparty.sessionOnly"] = true;
            GeckoPreferences.User["browser.xul.error_pages.enabled"] = true;
            GeckoPreferences.User["media.navigator.enabled"] = true;
            GeckoPreferences.User["media.navigator.permission.disabled"] = true;
            GeckoPreferences.User["browser.cache.disk.enable"] = true;
            GeckoPreferences.User["places.history.enabled"] = false;
            GeckoPreferences.Default["extensions.blocklist.enabled"] = false;

        }

        private void Form1_Load(object sender, EventArgs e)
        {

            geckoWebBrowser1.Navigate(prefer not to show);
        }

        private void reloadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            geckoWebBrowser1.Reload();
        }

        private void custemnumberToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {

        }

        private void reloadToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            geckoWebBrowser1.Navigate(pfere not to show again);
        }

        private void devToolsToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void cONFIGToolStripMenuItem_Click(object sender, EventArgs e)
        {
          geckoWebBrowser1.Navigate("about:config");
        }
    }
}

1 个答案:

答案 0 :(得分:0)

您已将network.cookie.thirdparty.sessionOnly设置为true,根据文档仅将其设置为当前会话。默认值为false。

  

第三方Cookie允许在一般Cookie接受设置的限制范围内,但仅保留在当前会话中。

https://developer.mozilla.org/pl/docs/Cookies_Preferences_in_Mozilla