How to create and maintain session


I am using HTML, C, CGI. Now I need to create and maintain sessions.How can I do that?

If any tutorial talks about this, please let me know.

Best Solution

Do you mean, if you create a session using a CGI program written in Perl, can you access it from a CGI program written in C? If so, it depends on how the Perl script stores its session data.

If you use CGI::Session, it looks like that's capable of storing session data in plain files, Berkeley DB files, or MySQL databases. All of those can be accessed by C programs, but you'll have to write C code to get the value of the CGISESSID cookie or query parameter, and look it up in the session file or database. Essentially, you have to reimplement at least the core functionality of CGI::Session in C.

If you're using something other than CGI::Session, it still has to store its session data somewhere, so you should still be able to access it from your C programs. You'll need to determine where and how it's stored, though.