HttpWebRequest vs. AxWebBrowser

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martin Madreza

    HttpWebRequest vs. AxWebBrowser

    Hello,

    I wrote a C# App with an internet connection over HttpWebRequest. To
    navigate thru some sites i need a cookie (CookieContaine r).

    Now i want to call a form with a AxWebBrowser displayin the website. i
    call the navigate methode to load the site but dont know how to set
    the cookie. I tried the header parameter from the navigate method or
    the AxHost but it wont work.

    Thankfull for any help

    MM
  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: HttpWebRequest vs. AxWebBrowser

    MM,

    How are you setting the cookie information in the header parameter as
    part of the call to Navigate? You have to set the cookie in the correct
    format.

    Hope this helps.

    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "Martin Madreza" <madmakdread@ya hoo.de> wrote in message
    news:f4b9403c.0 311170648.6cc13 35f@posting.goo gle.com...[color=blue]
    > Hello,
    >
    > I wrote a C# App with an internet connection over HttpWebRequest. To
    > navigate thru some sites i need a cookie (CookieContaine r).
    >
    > Now i want to call a form with a AxWebBrowser displayin the website. i
    > call the navigate methode to load the site but dont know how to set
    > the cookie. I tried the header parameter from the navigate method or
    > the AxHost but it wont work.
    >
    > Thankfull for any help
    >
    > MM[/color]


    Comment

    • Martin Madreza

      #3
      Re: HttpWebRequest vs. AxWebBrowser

      Hi,

      thanks.

      Do you know the correct format.

      Actually I tried this:

      HttpWebRequest webRequest = (HttpWebRequest )WebRequest.Cre ate(uri);
      webRequest.User Agent = "Mozilla/3.0 (compatible; My Browser/1.0)";
      webRequest.Cook ieContainer = cookieContainer ;
      string sHeader = cookieContainer .GetCookieHeade r(uri)
      //sHeader is something like id=56322110192
      object oHeader = (object)sHeader ;
      Object o = null;
      axWebBrowser.Na vigate(sSomeUrl , ref o, ref o, ref o, ref oHeader);


      MM


      "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote in message news:<#n6NBaSrD HA.3688@TK2MSFT NGP11.phx.gbl>. ..[color=blue]
      > MM,
      >
      > How are you setting the cookie information in the header parameter as
      > part of the call to Navigate? You have to set the cookie in the correct
      > format.
      >
      > Hope this helps.
      >
      > --
      > - Nicholas Paldino [.NET/C# MVP]
      > - mvp@spam.guard. caspershouse.co m[/color]

      Comment

      Working...