using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Gecko;
using System.IO;
using System.Runtime.InteropServices; namespace 独立Cookie
{
public partial class Form1 : Form
{
static private string xulrunnerPath = Application.StartupPath + "\\xulrunner"; public Form1()
{
InitializeComponent();

       /* 关键代码 */
string profileDir = DateTime.Now.ToString("yyyyMMddHHmmss"); //定义独立cookie的文件夹名称
            string directory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), Path.Combine("Geckofx", profileDir));
if (!Directory.Exists(directory))
Directory.CreateDirectory(directory);
Gecko.Xpcom.ProfileDirectory = directory;
        /* 关键代码 结束 */
        Gecko.Xpcom.Initialize(xulrunnerPath); 
        GeckoPreferences.User["gfx.font_rendering.graphite.enabled"] = true;
        Gecko.CertOverrideService.GetService().ValidityOverride += geckoWebBrowser1_ValidityOverride;
        gwb.Navigate("http://baidu.com");
    }     private void geckoWebBrowser1_ValidityOverride(object sender, Gecko.Events.CertOverrideEventArgs e) {
      e.OverrideResult = Gecko.CertOverride.Mismatch | Gecko.CertOverride.Time | Gecko.CertOverride.Untrusted; e.Temporary = true; e.Handled = true; }
    }
}

黄聪:GeckoWebBrowser多窗口独立cookie的更多相关文章

  1. 黄聪:wordpress如何携带cookie模拟浏览器访问网站

    $args = array( 'user-agent' => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, li ...

  2. 黄聪:《跟黄聪学WordPress主题开发》

    又一个作品完成!<跟黄聪学Wordpress主题开发>,国内最好的Wordpress主题模版开发视频教程!! 目录预览: WordPress官方源文件层式结构讲解 WordPress数据库 ...

  3. 黄聪:VS2010开发如何在c#中使用Ctrl、Alt、Tab等全局组合快捷键

    1.新建一个类 HotkeyHelper  using System; using System.Runtime.InteropServices; using System.Windows.Forms ...

  4. 黄聪:如何使用CodeSmith批量生成代码(转:http://www.cnblogs.com/huangcong/archive/2010/06/14/1758201.html)

    先看看CodeSmith的工作原理: 简单的说:CodeSmith首先会去数据库获取数据库的结构,如各个表的名称,表的字段,表间的关系等等,之后再根据用户自定义好的模板文件,用数据库结构中的关键字替代 ...

  5. 黄聪:Microsoft Enterprise Library 5.0 系列教程(一) : Caching Application Block (初级)

    原文:黄聪:Microsoft Enterprise Library 5.0 系列教程(一) : Caching Application Block (初级) 本篇文章具体官方解释请参照以下链接: h ...

  6. 黄聪:Microsoft Enterprise Library 5.0 系列教程(十) Configuration Application Block

    原文:黄聪:Microsoft Enterprise Library 5.0 系列教程(十) Configuration Application Block 到目前为止,我们使用的模块都是在同一个配置 ...

  7. 黄聪:wordpress教程

    又一个作品完成!<跟黄聪学Wordpress主题开发>,国内最好的Wordpress主题模版开发视频教程!! 目录预览: WordPress官方源文件层式结构讲解 WordPress数据库 ...

  8. [转]黄聪:如何使用CodeSmith批量生成代码

    本文转自:http://www.cnblogs.com/huangcong/archive/2010/06/14/1758201.html 在上一篇我们已经用PowerDesigner创建好了需要的测 ...

  9. 黄聪:《跟黄聪学WordPress插件开发》

    续<跟黄聪学WordPress主题开发>之后,又一个作品完成!<跟黄聪学Wordpress插件开发>,国内最好的Wordpress插件开发视频教程!! 目录预览: WordPr ...

随机推荐

  1. Android中通过注解代替findViewById方法

    转自:http://www.2cto.com/kf/201405/302998.html 这篇文章主要讲解注解实现findViewById的功能,首先我们来熟悉一下在java中怎么定义一个注解和解析一 ...

  2. Linux标准出错重定向导出

    ~$ ls han >1.txt 2>&1

  3. 使用 RequireJS 优化 Web 应用前端

    基于 AMD(Asynchronous Module Definition)的 JavaScript 设计已经在目前较为流行的前端框架中大行其道,jQuery.Dojo.MooTools.EmbedJ ...

  4. Hibernate 随记(数据库映射流程)

      ORM:Object/Relationship Mapping  对象/关系映射   实现流程:   1.项目中导入Hibernate相关类包并创建配置文件.Hibernate.cfg.xml(可 ...

  5. wget命令详解

    1.使用wget下载单个文件 以下的例子是从网络下载一个文件并保存在当前目录 wget http://cn.wordpress.org/wordpress-3.1-zh_CN.zip 在下载的过程中会 ...

  6. LintCode Subarray Sum

    For this problem we need to learn a new trick that if your start sum up all elements in an array. Wh ...

  7. C#编程语言与面向对象——抽象基类与接口

    在一个类前加“abstract”关键字,此类就成为抽象类. 对应的,在一个方法前加“abstract”关键字,此方法就成为抽象方法. abstract class Fruit //抽象类 { publ ...

  8. dede channel 增加limit(属性)功能

    dede channel 标签添加 limit(属性)功能 在用dede建站的时候,往往会需要用到一些需要自定义的普通需求,今天在这里介绍channel的limit功能,有时候我们需要调用中间部分数据 ...

  9. JavaScript:修改作用域外变量

    今天在看JavaScript学习指南的时候做的课后习题,也因此详细的对函数的传入参数进行比较深入的研究. 题目如下: 函数如何才能修改其作用域之外的变量?编写一个函数,由1~5的数字组成的数组作为参数 ...

  10. UVa 12166 修改天平

    https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...