🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.web
3 messages
3 total messages Started by Mike Ruskai Fri, 30 May 2008 21:24
TCppWebBrowser cookie problem
#110
Author: Mike Ruskai
Date: Fri, 30 May 2008 21:24
59 lines
2695 bytes
I'm using TCppWebBrowser to display a web page in my application.

CTRL-clicking a point on that page causes a POST, which then triggers a
response like this is from the server:

=====
HTTP/1.1 200 OK
Date: [date]
Server: [server ID]
Set-Cookie: [cookie name]=[cookie value] 
Content-Length: [length]
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8

<HTML>
<HEAD>
<SCRIPT language="JavaScript">
function openDetailWin() {
  var win =
window.open('[URL]','[title]','height=500,width=750,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,location=no');
  win.focus();
}
</SCRIPT>
</HEAD>
<BODY onload="openDetailWin();">
[non-visible text]
</BODY>
</HTML>
=====

Note, in particular, the fact that it's specifying a cookie name and value.
That's the session cookie, required to authenticate the browser.

The window is opened, but that window issues this request:

=====
GET [URL] HTTP/1.1
Accept: */*
Accept-Language: en-us
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648)
Host: [host]
Connection: Keep-Alive
=====

Note that absence of a cookie, which prevents the content from being
retrieved.  That absence of a cookie is literally the only difference between
the request made via a new window from the TCppWebBrowser control and a
standalone IE instance that's viewing the same page.

Now here's the strange bit.  If I open that standalone IE instance and load
the main page in question, the TCppWebBrowser control adds the cookie to the
popup window content request.  Close the IE instance, and the cookie
disappears from the request again.

Anyone have any ideas on how to work around this problem?
Re: TCppWebBrowser cookie problem
#111
Author: Remy Lebeau (TeamB)
Date: Fri, 30 May 2008 22:25
21 lines
1726 bytes
"Mike Ruskai" <BUTthannydI@DONTearthlinkLIKE.netSPAM> wrote in message 
news:qir044h4vduuvh2fni5hs81sr50aabjqlt@4ax.com...

> Note, in particular, the fact that it's specifying a cookie name
> and value. That's the session cookie, required to authenticate
> the browser.
>
> The window is opened, but that window issues this request:
<snip>
> Note that absence of a cookie, which prevents the content from
> being retrieved.

I am guessing that you are not using the TCppWebBrowser::OnNewWindow2 event 
to create a new TCppWebBrowser instance, is that right?  If you are not, 
then the browser creates the new window in a separate process.  If the 
cookie is a temporary session cookie, that process would not have access to 
it.


Gambit 
Re: TCppWebBrowser cookie problem
#112
Author: Mike Ruskai
Date: Sat, 31 May 2008 05:43
26 lines
2020 bytes
On or about Fri, 30 May 2008 15:25:59 -0700 did "Remy Lebeau \(TeamB\)"
<no.spam@no.spam.com> dribble thusly:

>
>"Mike Ruskai" <BUTthannydI@DONTearthlinkLIKE.netSPAM> wrote in message 
>news:qir044h4vduuvh2fni5hs81sr50aabjqlt@4ax.com...
>
>> Note, in particular, the fact that it's specifying a cookie name
>> and value. That's the session cookie, required to authenticate
>> the browser.
>>
>> The window is opened, but that window issues this request:
><snip>
>> Note that absence of a cookie, which prevents the content from
>> being retrieved.
>
>I am guessing that you are not using the TCppWebBrowser::OnNewWindow2 event 
>to create a new TCppWebBrowser instance, is that right?  If you are not, 
>then the browser creates the new window in a separate process.  If the 
>cookie is a temporary session cookie, that process would not have access to 
>it.

I hadn't even an inkling that such handling was necessary.  I just did a quick
test, assigning the interface of a second browser control in the event, and it
works.  Now I just have to create a popup browser form and add a bunch of code
to my wrapper class.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads