I am using session container and store the arrays in a session. When i logged in then on the first time it give me undefined variable when i refresh the same page then it is working why?
$container = new Container('user');
$container->accesData=$data;
where $data is an array.
in my view i am accessing this session container as
$container = new Container('user');
$accessData=$container->accesData;
on the first time it give me an error while refreshing the same working fine why?
Recently i checked my project.
Actually what is happening?
I am performing logging from the login module after that i collect an assoc array and save it into the session from the module Case its working fine from till this stage and redirecting to the account module but the array which i store earlier is lost for the one time when i refresh the same its working inside account module. I don't know what is going on. Any one help me please?
Related
I have an MVC web application that uses a Singleton object to get and store user identity information once. This object is stored as part of the model class.
Everything works fine when I'm running locally in Debug mode. It loads the Singleton at startup and when I exit and run again, it reloads. I assume this is because IIS express clears everything when the process exits.
When I publish to an actual web server, however, it loads the Singleton and seems to keep it around, even if I exit the website and return later. I'm not sure if this is because of caching or session information is being retained.
Can someone explain a good way to load data once but force it to be cleared on exit? I'm having difficulty understanding the scope and lifetime of data in an MVC application.
Thanks.
So I followed the first answer here - How to use passport with express and socket.io?
And right now I can do socket.request.session.user and it returns me the id of the user. But that's it.. nothing else.
Which is strange because when I use req.user I get a whole user object and I can do things like req.user.id, req.user.username, etc.
When I do req.session.passport.user I only get the ID again.
So how can I sync it up with the socket.io authentication and get the full req.user object?
I have installed ejabberd on my system and gems 'xmpp4r', 'ruby_bosh'. I'm trying to make a chat client using strophejs in my views. Now I'm getting jid, sid and rid with BOSH and can save them in session using in view after this all.
So I'm connecting strophejs to http-bind like
var connection = new Strophe.Connection('http://localhost:5280/http-bind/');
and trying to attach my session like
connection.attach("#{bosh_session_jid}", "#{bosh_session_id}", "#{bosh_session_random_id}", function(status){
console.log(status);
});
bosh_session_jid, bosh_session_rid and bosh_session_sid are this identifiers that I should use and they are not changed.
So, at first connection attempt everything is connected and working ok and I even can send message. But after window reloading (F5 I mean) it's trying to reconnect and reattach process and sends me
POST http://localhost:5280/http-bind/ 404 (Not Found)
I read "Professional XMPP programming with JS and jQuery" and found line
Each subsequent request increments the RID by one.
So, do I need to increase rid by 1 in my cookies after each attach? Or then? Or I don't need to?
You must increment the RID yourself when refreshing or changing pages. I increment by 1 when loading the new page before attaching. Note: if you are storing in a cookie, you should update with every call returned with the new RID, so that your cookie is updated with the most current RID.
I've been getting quite a lot of session collision exceptions. Usually at least one per day, but sometimes I deploy and get 2-3 in a row and then nothing.
The app runs on Rails 3.2.2 and unicorn, and sessions are stored in memcached.
The exceptions happen in different places in different controllers and I'm not really able to find anything they have in common. What could be causing this?
I don't know how ruby/rails handles session data using memcached but normally the work is as follows:
new session -> using command ADD
update session -> using GET with token and than the command CAS (check and set)
If there is a hash collision the command ADD fails because the session already exists.
Another possible issue is if another process updated the same session between GET and CAS.
I have developed a little app that uses session.
In the local server it's working perfectly - I can store and retrieve some data to/from the session.
But when I pushed the code to Heroku platform, my app does not work. The session is always empty.
I don't understand where the problem? Any ideas.
In fact, the session is ok. I have added the debug output everywhere and I see that the session is ok. The problem comes from the internal app's logic.