HttpWebRequest vs. AxWebBrowser

  • Thread starter Thread starter Martin Madreza
  • Start date Start date
M

Martin Madreza

Hello,

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

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
 
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.
 
Hi,

thanks.

Do you know the correct format.

Actually I tried this:

HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(uri);
webRequest.UserAgent = "Mozilla/3.0 (compatible; My Browser/1.0)";
webRequest.CookieContainer = cookieContainer;
string sHeader = cookieContainer.GetCookieHeader(uri)
//sHeader is something like id=56322110192
object oHeader = (object)sHeader;
Object o = null;
axWebBrowser.Navigate(sSomeUrl, ref o, ref o, ref o, ref oHeader);


MM
 
Back
Top