in reply to Re: session ID
in thread session ID

Replies are listed 'Best First'.
Re: Re: Re: session ID
by ssr (Initiate) on Oct 04, 2003 at 15:14 UTC
    I am trying to get the value of my session ID in the following perl code:
    $sid = "<%= Request.ServerVariables(\"HTTP_COOKIE\") %>" ;
    print "session id is $sid \n";
    BUT nothing happens. What am doing wrong? Please HELP.
      Yikes! OK - we need some basic information here.

      Is this a perl script you are trying to run OUTSIDE OF IIS/ASP, or is this part of an ASP page ?

      It will not work outside ASP.

      If you are doing this inside ASP, why is the "$sid" variable outside the "<%" ?
      Are you trying to do some funky client-side perl-script that gets info from the server ?
      If you do not know the answer to the above question, I suspect the answer is NO - in which case your script needs to be all server side, thus:

      <% $sid = Request.ServerVariables("HTTP_COOKIE"); %>
        Thanks very much for our response. My programs are pre-dominantly written in PERL and they run on IIS. I know a strange combination.

        When a client log on to our application (.pl program), if they get through with correct username and password, IIS issues a session id to the client (which can be captured in ASP like you mentioned above in your response earlier) and that is the session id I am trying to capture to be able use to mainatain stateful, session ofcourse with a time limit etc.,

        I read somewhere about http_session_id but I am unable to find more information on it.

        I also heard that it might be retrievable with PERLIIS.DLL. But I am still looking for details on that.

        cgi::session or apache::session would not work for me as I do not want to generate and issue session ids.

        ANY HELP IS GREATLY APPRECIATED!! THANKS!!!!!!
      That's the same as writing
      $sid = "<%delete hard disk%>";
      print "session id is $sid \n";
      Perl is not ASP. Look at $ENV{HTTP_COOKIE} to see if it contains a value.
        OK - I'm beginning to get the picture.

        Your ".pl" script runs in a cgi context, and is unaware of the ASP "session".

        You need to realize that you CAN write an asp page in perl. This is called "perlscript". This has full access to all $Session variables. Please research this in the perl docs.