[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

cgi sessions not working :S

Javier Valencia

2/25/2005 2:02:00 PM

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.



3 Answers

Ariff Abdullah

2/25/2005 3:12:00 PM

0

On Fri, 25 Feb 2005 23:02:05 +0900
Javier Valencia <jvalencia@log01.org> wrote:
> 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.My... (IPv6/IPv4)
http://staff.My... (IPv6/IPv4)
http://tomoyo.My... (IPv6/IPv4)


Javier Valencia

2/25/2005 6:48:00 PM

0

Ariff Abdullah wrote:

>On Fri, 25 Feb 2005 23:02:05 +0900
>Javier Valencia <jvalencia@log01.org> wrote:
>
>
>>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.My... (IPv6/IPv4)
>http://staff.My... (IPv6/IPv4)
>http://tomoyo.My... (IPv6/IPv4)
>
>
>
Yeah, it worked, thanks.
Where did you find such info?



Ariff Abdullah

2/25/2005 8:43:00 PM

0

On Sat, 26 Feb 2005 03:48:11 +0900
Javier Valencia <jvalencia@log01.org> wrote:
> Ariff Abdullah wrote:
>
> >On Fri, 25 Feb 2005 23:02:05 +0900
> >Javier Valencia <jvalencia@log01.org> wrote:
> >
> >
> >>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.My... (IPv6/IPv4)
http://staff.My... (IPv6/IPv4)
http://tomoyo.My... (IPv6/IPv4)