ActiveX IE Object Cookies

E

Ernest Griffin

I am developing a windows application to run the IE
object(AxSHDocVw.AxWebBrowser) in kiosk mode. I am interested in how to
clear the cookies associated to the session that I am working in that
may be placed by the sites visited. This would be called through a
button on the title bar. The following is my code to date:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace TestIEProgram
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private AxSHDocVw.AxWebBrowser axWebBrowser1;
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private object pobjMissing = System.Reflection.Missing.Value;
private object strurl = "http://www.anywhere.com";
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

axWebBrowser1.Navigate2(ref strurl, ref pobjMissing, ref
pobjMissing,ref pobjMissing, ref pobjMissing);
//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(Form1));
this.axWebBrowser1 = new AxSHDocVw.AxWebBrowser();
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).Begi
nInit();
this.SuspendLayout();
//
// axWebBrowser1
//
this.axWebBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;
this.axWebBrowser1.Enabled = true;
this.axWebBrowser1.Location = new System.Drawing.Point(0, 0);
this.axWebBrowser1.OcxState =
((System.Windows.Forms.AxHost.State)(resources.GetObject("axWebBrowser1.
OcxState")));
this.axWebBrowser1.Size = new System.Drawing.Size(696, 357);
this.axWebBrowser1.TabIndex = 0;
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[]
{
this.menuItem1});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.Text = "&Home";
this.menuItem1.Click += new
System.EventHandler(this.menuItem1_Click);
//
// Form1
//
this.AccessibleRole = System.Windows.Forms.AccessibleRole.None;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.CausesValidation = false;
this.ClientSize = new System.Drawing.Size(696, 357);
this.ControlBox = false;
this.Controls.Add(this.axWebBrowser1);
this.MaximizeBox = false;
this.Menu = this.mainMenu1;
this.MinimizeBox = false;
this.Name = "Form1";
this.ShowInTaskbar = false;
this.Text = "Form1";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).EndI
nit();
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());


}

private void menuItem1_Click(object sender, System.EventArgs e)
{
// I want to Clear the Cookies Here!!!

axWebBrowser1.Navigate2(ref strurl, ref pobjMissing, ref
pobjMissing,ref pobjMissing, ref pobjMissing);

}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top