Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CGI::Session not saving with IIS??

Status
Not open for further replies.

adrive

Programmer
Oct 14, 2007
12
0
0
MY
interestingly enough, whenever i try creating a virtual directory with IIS (5.1) - (WinXP), my session objects somehow gets lost somewhere in between pages.<br><br>

to do this :

1.) create a folder "test" let's say on C:\ and put all teh files inside.
2.) right click on the folder, properties->websharing->share the folder and check everything in checkboxes.
3.) now access testsession.pl with a web browser.
4.) the page will show, with session id, and also it'll show on the next page with its found session object.

5.) now..

6.) go to IIS, under default web site, find "test" virtual directory and set its properties->directory security->anonymous access checked.
7.) apply and restart IIS.
8.) now, try running testsession.pl again...and when you move to the next page, your session is gone!


why is this happening??? (happening to me).
the reason why i wanted to set anonymous access on lower level folder "test" is because it'll prompt me a authentication screen if i use ie6 or firefox when viewing the first page.


file 1 : testsession.pl

<code>
#!/usr/bin/perl
print "content-type: text/html \n\n";

use CGI;
use CGI::Session qw/-ip-match/;
use File::Spec;

# my $session = new CGI::Session("driver:File", undef, {Directory=>File::Spec->tmpdir});
my $session = new CGI::Session();
my $sessionid = $session->id();

print "<BODY>";
print " <FORM ACTION=\"testsession2.pl\">";
print "<INPUT TYPE=\"hidden\" NAME=sessionid VALUE=" . $sessionid . "/>";
print "current session : " . $sessionid;
print "<INPUT TYPE=\"SUBMIT\" VALUE=\"go next\">";
print "</FORM>";
print "</BODY>";


</code>

testsession2.pl

<code>
#!/usr/bin/perl
print "content-type: text/html \n\n";

use CGI;
use CGI::Session qw/-ip-match/;

my $cgi = new CGI;

my $sessionid = $cgi->param("sessionid");

print "current session id ($sessionid)";

my $session = CGI::Session->load($sessionid);

if(!$session->is_empty()){
print "<BODY>";
print " <FORM ACTION=\"testsession.pl\">";
print "<br><br>found session object from sessionid : " . $session->id();
print "<INPUT TYPE=\"SUBMIT\" VALUE=\"back\">";
print "</FORM>";
print "</BODY>";
}else{
print "<BODY>";
print " <br><br>weird enough...session object is lost!";
print "</BODY>";
}


</code>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top