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

Esteemed monks,

I have a web application comprised of an application layer in .NET 2.0. (believe me it wasn't my idea!) and UI layer with Perl.

Now I want to access the .NET session from the Perl code.
Has anyone have experience in this?

The server is IIS 7 w/ MSSQL. Currently I'm using Perl CGI. .NET side is coded as a C# webservice.
Thanks a lot!

------------------------------ "geneva will not marry you no matter how much you love Larry Wall." Geneva Wall, Larry Wall's daughter
  • Comment on Perl sharing session state with ASP.NET

Replies are listed 'Best First'.
Re: Perl sharing session state with ASP.NET
by digger (Friar) on Jan 27, 2008 at 00:04 UTC

    Session state is a .Net object. The only way I know of to access .Net objects using Perl is using PerlNET from ActiveState.

    To keep from having to rewrite your GUI code in Perl.NET, you could write an interface class that sits between the .Net code and perl, and exposes methods to get Session variables.

    Alternatively, if you own the code for the web service, you could just expose the important information via the web service, and use SOAP calls from perl to get what you need. This way you keep the perl and .Net portions completely separate.

    HTH,
    digger

      So, how is this thing stored? In memory? Plain file? RDBMS? Can't we do a low-level access like we do for PHP sessions?
      Hi digger thank you for the response. I indeed own the webservice and I can use the SOAP::Lite to interact it.
      Here is one scenerio I tested:
      Javascript triggers the login webservice, user logs in, then javascript calls a Perl code which triggers another webservice via SOAP::Lite.
      The webservice checks the session to see if the user is logged in, and returns FALSE to Perl. But the user has just logged in!
      The .NET session seems to have an organic connection with the user agent. When I show our CGI::Session to the C# folks, they just stare at the monitor. hehehe...
      BUT when the webservice call checks whether the user has logged in or not via the session, I always get false.