Get ASP-SessionID on the first page hit

Get ASP-SessionID on the first page hit

am 02.07.2007 16:27:02 von Alex

When I hit my homepage the first time (e.g. after a reboot), the
server variable HTTP_COOKIE is empty. If I reload the page,
HTTP_COOKIE has got a value. This makes sense, but I'm looking to
request HTTP_COOKIE on the first page hit. Any ASP-based ideas?
(Otherwise I'll program a page reloader...)

Re: Get ASP-SessionID on the first page hit

am 02.07.2007 16:45:55 von reb01501

alex@kuehnefruit.ch wrote:
> When I hit my homepage the first time (e.g. after a reboot), the
> server variable HTTP_COOKIE is empty. If I reload the page,
> HTTP_COOKIE has got a value. This makes sense, but I'm looking to
> request HTTP_COOKIE on the first page hit. Any ASP-based ideas?
> (Otherwise I'll program a page reloader...)

Use application_onstart in global.asa to initialize it?
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Re: Get ASP-SessionID on the first page hit

am 03.07.2007 09:43:27 von Daniel Crichton

alex@kuehnefruit.ch wrote on Mon, 02 Jul 2007 07:27:02 -0700:

> When I hit my homepage the first time (e.g. after a reboot), the
> server variable HTTP_COOKIE is empty. If I reload the page,
> HTTP_COOKIE has got a value. This makes sense, but I'm looking to
> request HTTP_COOKIE on the first page hit. Any ASP-based ideas?
> (Otherwise I'll program a page reloader...)

The cookie is data sent from the browser to the server, which has previously
been sent from the server to the browser. In the case of the first hit to a
site, there has been no data sent from server->browser that can be returned,
so it will be empty (unless there is a persistent cookie from an earlier
visit). You will need to get the browser to load a 2nd page in order for the
cookie to be returned. Any way of doing it without the browser hitting the
site a second time will not be reliable because the browser may well ignore
the outgoing cookie. This of course produces another issue - if the browser
ignores cookies, what will you do then?

Dan