Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

lets see if the monks can impress me with their erudition once again...

I need to read session variables set in an asp page ie
loginname = Session("loginname")

how would I get this value in a perl script?

thanks

Chris

Replies are listed 'Best First'.
Re: reading asp session variables in a perl script
by perrin (Chancellor) on Aug 28, 2003 at 14:10 UTC
    Is your Perl script running as an ASP page or not? ASP is not a language, and ASP pages can be written in VBScript, JScript, or Perl (using ActiveState's PerlScript). If you're trying to read session variables set from an ASP page in a Perl CGI script, you are probably out of luck, since Microsoft does not provide information on how to access their session storage from external programs. You might be able to figure it out if you are storing the ASP session data in a database.
      the perl script is a seperate cgi file that is called from the asp page

      the session variables, however, are set with vbscript in an asp page...
        Okay then, unless you can figure something out using COM objects you won't be able to access them easilly. Try getting ASP to store them in a SQL database and see if you can find them in there, or else make your VBScript store them in a different way, like writing them to a file or database table. Microsoft's session handling is proprietary, so the only way to get access to it is to reverse engineer it.
Re: reading asp session variables in a perl script
by NetWallah (Canon) on Aug 28, 2003 at 20:36 UTC
    I noticed a lot of misconceptions about perlscript in ASP pages in previous responses to your question. The answer is quite simple:
    #Assuming you have set the LOGINNAME session var somewhere, $loginname = $Session->{LOGINNAME};
    The $Session object is a pre-defined (intrinsic) object, if you are running inside an ASP page. This is the SAME object you would access if your ASP page used VBSCRIPT.

    For ASP programming with perl, see
    http://aspn.activestate.com/ASPN/docs/ActivePerl/Windows/ActiveServerPages.html

Re: reading asp session variables in a perl script
by tcf22 (Priest) on Aug 28, 2003 at 17:03 UTC
    The easiest option I see, is storing the Session Vars in a DB. The ASP Session ID is stored in a cookie, so you can use that as the identifier in the DB. Do the insert in ASP and query out the data in Perl with a mixture of CGI::Cookie and DBI.

    Although there may be some COM objects buried deep inside the MSDN, that allows you to access this info with Win32::OLE.