Get ASP-SessionID on the first page hit

A

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...)
 
B

Bob Barrows [MVP]

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?
 
D

Daniel Crichton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top