For Programmers: Free Programming Magazines  


Home > Archive > C# > March 2004 > for 4 weeks - My Cookie Problem?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author for 4 weeks - My Cookie Problem?
Martin Madreza

2004-03-28, 10:28 pm

hi,

i know cookies are evil and no one should use them - but my work needs
to solve this problem

now i use a hack, but i couldn't be the right way to load the webpage
twice

on creating the AxWebBrowser the cookie is known and i call
this.axWebBrowserStandAlone.Navigate(this.sUrl)
from somewhere in the class. inside the NavigateComplete2 i wrote
stuff like this.

NavigateComplete2
{
IHTMLDocument2 doc =
(IHTMLDocument2)this.axWebBrowserStandAlone.Document;
if(doc != null && bFirst && doc.cookie == null)
{
this.axWebBrowserStandAlone.Visible = false;
bFirst = false;
doc.cookie = this.sCookie;
this.axWebBrowserStandAlone.Navigate(this.sUrl); //how bad to call
this twice
}
}

so first the program try to display the this.sUrl, the browser is
redirected to an error page and then i call again the navigate. i'm
gettin sick when i look at this hack and the must be an easier way to
set an cookie. i tried the postData and header etc. nothing works...

please someone help me or give me a hint. maybe my problem is not
clear, please say.

MM
N.K

2004-03-28, 10:28 pm

I replied to your post dated 4th Feb , you will find one approach that
worked there..

madmakdread@yahoo.de (Martin Madreza) wrote in message news:<f4b9403c.0402060537.63b31c31@posting.google.com>...
> hi,
>
> i know cookies are evil and no one should use them - but my work needs
> to solve this problem
>
> now i use a hack, but i couldn't be the right way to load the webpage
> twice
>
> on creating the AxWebBrowser the cookie is known and i call
> this.axWebBrowserStandAlone.Navigate(this.sUrl)
> from somewhere in the class. inside the NavigateComplete2 i wrote
> stuff like this.
>
> NavigateComplete2
> {
> IHTMLDocument2 doc =
> (IHTMLDocument2)this.axWebBrowserStandAlone.Document;
> if(doc != null && bFirst && doc.cookie == null)
> {
> this.axWebBrowserStandAlone.Visible = false;
> bFirst = false;
> doc.cookie = this.sCookie;
> this.axWebBrowserStandAlone.Navigate(this.sUrl); //how bad to call
> this twice
> }
> }
>
> so first the program try to display the this.sUrl, the browser is
> redirected to an error page and then i call again the navigate. i'm
> gettin sick when i look at this hack and the must be an easier way to
> set an cookie. i tried the postData and header etc. nothing works...
>
> please someone help me or give me a hint. maybe my problem is not
> clear, please say.
>
> MM

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com