# CGI::Session Problem

**URL:** <https://www.ruby-forum.com/t/cgi-session-problem/153011>\
**Category:** Ruby\
**Created:** [November 11, 2008, 3:55am UTC](https://www.ruby-forum.com/t/cgi-session-problem/153011 "2008-11-11T03:55:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![omgitsads](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/dbc845/32.png) [@omgitsads](https://www.ruby-forum.com/u/omgitsads)\
**Post date:** [November 11, 2008, 3:55am UTC](https://www.ruby-forum.com/t/cgi-session-problem/153011/1 "2008-11-11T03:55:15Z")

</div>

Hello,

I am creating my own random 16 digit session\_id and am passing the id  
through the cgi params to keep track of it. The problem is that the  
session\_id does not seem to be set.

The following is in a login.rb code where i initially create the  
session:

where sid is some 16 char string

cgi = CGI.new(“html4”)

session = CGI::Session.new(cgi, ‘new\_session’ =\> true, ‘prefix’ =\>  
‘sid.’, ‘session\_id’ =\> sid)

session.close

the session is creating but with the ruby generated session\_id! This is  
driving me nuts the prefix is there but my session id is not being set  
properly.

Any ideas???
