[Gtk-sharp-list] Gecko configurable http headers browser?

Jose Manrique Lopez de la Fuente jsmanrique_lopez at yahoo.es
Thu May 18 11:38:20 EDT 2006


I am trying to make a small gecko based browser that could let the
user to configure some headers, but  it seems that LoadUrl method in
gecko-sharp is not as powerful as I've thought. I need to change
headers to see if website content is adapted to the browser that
request it.

I have tried a different aproach, downloading the file with
HttWebRequest and rendering it locally, but I get awful code (no utf-8
strings appear, no images, etc..). I paste the code downside.

I have found that there is a OpenUriArgs class, what does it do? Could
it be use for this?

Any idea about how to do this?

Thank you very much,

==== code ====
using System;
using System.IO;
using System.Net;
using Gtk;
using Gecko;

class GeckoTester {
       public static void Main (string[] args)
               GeckoTester b = new GeckoTester();

       Gecko.WebControl webctl;
       Gtk.Entry urlbox;

       static string greeting=
               "<html><head><title>Hola Mundo</title></head>"+
               "<body><h1>Hola Mundo</h1></body></html>";

       public GeckoTester()
               Window w = new Window ("Browser test");
               VBox v = new VBox();
               urlbox =new Entry();
               urlbox.Activated += Load_Url;
               webctl = new WebControl();
               v.PackStart(urlbox, false, false, 0);
               v.PackEnd(webctl, true, true, 0);

               w.DeleteEvent += Window_Delete;

               webctl.RenderData (greeting, "file:///tmp", "text/html");

       void Load_Url (object o, EventArgs args)
       /*      webctl.LoadUrl (urlbox.Text); */
               HttpWebRequest request = (HttpWebRequest)
               request.UserAgent = "jsmanrique's browser";
               WebResponse response = request.GetResponse();

               StreamReader reader = new StreamReader

               webctl.RenderData (reader.ReadToEnd(), "file:///tmp",

       void Window_Delete (object o, DeleteEventArgs args)
J. Manrique López de la Fuente
msn: jsmanrique at asturlinux.org
jabber: jsmanrique at jabber.org

More information about the Gtk-sharp-list mailing list