cgi sessions not working :S


J

Javier Valencia

I have a eruby page, which makes a new session just for fun. The code is:

cgi = CGI.new("html4")
session = CGI::Session.new(cgi, 'new_session' => true, 'prefix' =>
'rubyweb')
session['username'] = "rambo"
session.close

Then the header have a meta redirection to a simple script that creates
a session from an existing one:

cgi = CGI.new("html4")
session = CGI::Session.new(cgi, "new_session" => false, "prefix" =>
"rubyweb")

The problem is that my last session is NIL, so it's not working.
I have coockies enabled in my browser (firefox).
What's happening?
Thanks.
 
Ad

Advertisements

A

Ariff Abdullah

I have a eruby page, which makes a new session just for fun. The
code is:

cgi = CGI.new("html4")
session = CGI::Session.new(cgi, 'new_session' => true, 'prefix' =>
'rubyweb')
session['username'] = "rambo"
session.close

Then the header have a meta redirection to a simple script that
creates a session from an existing one:

cgi = CGI.new("html4")
session = CGI::Session.new(cgi, "new_session" => false, "prefix" =>
"rubyweb")

The problem is that my last session is NIL, so it's not working.
I have coockies enabled in my browser (firefox).
What's happening?
Thanks.

How about this:

cgi = CGI.new("html4")
ERuby.cgi = cgi
session = ....
....


--

Ariff Abdullah
MyBSD

http://www.MyBSD.org.my (IPv6/IPv4)
http://staff.MyBSD.org.my (IPv6/IPv4)
http://tomoyo.MyBSD.org.my (IPv6/IPv4)
 
J

Javier Valencia

Ariff said:
I have a eruby page, which makes a new session just for fun. The
code is:

cgi = CGI.new("html4")
session = CGI::Session.new(cgi, 'new_session' => true, 'prefix' =>
'rubyweb')
session['username'] = "rambo"
session.close

Then the header have a meta redirection to a simple script that
creates a session from an existing one:

cgi = CGI.new("html4")
session = CGI::Session.new(cgi, "new_session" => false, "prefix" =>
"rubyweb")

The problem is that my last session is NIL, so it's not working.
I have coockies enabled in my browser (firefox).
What's happening?
Thanks.

How about this:

cgi = CGI.new("html4")
ERuby.cgi = cgi
session = ....
....


--

Ariff Abdullah
MyBSD

http://www.MyBSD.org.my (IPv6/IPv4)
http://staff.MyBSD.org.my (IPv6/IPv4)
http://tomoyo.MyBSD.org.my (IPv6/IPv4)
Yeah, it worked, thanks.
Where did you find such info?
 
Ad

Advertisements

A

Ariff Abdullah

Ariff said:
I have a eruby page, which makes a new session just for fun. The
code is:

cgi = CGI.new("html4")
session = CGI::Session.new(cgi, 'new_session' => true, 'prefix' =>
'rubyweb')
session['username'] = "rambo"
session.close

Then the header have a meta redirection to a simple script that
creates a session from an existing one:

cgi = CGI.new("html4")
session = CGI::Session.new(cgi, "new_session" => false, "prefix" => >"rubyweb")

The problem is that my last session is NIL, so it's not working.
I have coockies enabled in my browser (firefox).
What's happening?
Thanks.

How about this:

cgi = CGI.new("html4")
ERuby.cgi = cgi
session = ....
....
Yeah, it worked, thanks.
Where did you find such info?

Nowhere, really. Funny, isn't it?

Some (ruby-talk/34469) might suggest this way:

ERuby.noheader = true
cgi = CGI.new()
session = CGI::Session.new(cgi)
print cgi.header
...

which is not so elegant (for me, it feels like committing suicide),
yet working.


--

Ariff Abdullah
MyBSD

http://www.MyBSD.org.my (IPv6/IPv4)
http://staff.MyBSD.org.my (IPv6/IPv4)
http://tomoyo.MyBSD.org.my (IPv6/IPv4)
 

Top