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.
 
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?
 
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top