Session_Start() not working

Topics: Web Client Software Factory
Feb 14, 2011 at 1:55 PM
Edited Feb 14, 2011 at 1:55 PM

Hello,

I need desparate help with Session_Start() in WCSF. I have got it working. But, the problem is that session seems to be shared. In Session_Start, I am setting a RootContainer service to NULL that sets the user profile. But, when application is run from the server, users see each other's profiles instead of their own. Here is the code:

proteced void Session_Start(object sender, EventArgs e)
{
     _securityService = RootContainer.Services.Get<ISecurityService>();
     
     _securityService.UserProfile = null;
}

Doing this does not seem to set _securityService.UserProfile = null for every session. Sometimes, it does work fine. But then, users start seeing eachother's profiles on their computers. Please help. I will really appreciate it.

Thanks!

Feb 14, 2011 at 5:58 PM

Hi,

One possible cause for the behavior that you’re experiencing could be that you’re not calling the Abandon method of your current session when an user logs out of your application. From the MSDN documentation:

Once the Abandon method is called, the current session is no longer valid and a new session can be started. Abandon causes the End event to be raised. A new Start event will be raised on the next request.

Session identifiers for abandoned or expired sessions are recycled by default. That is, if a request is made that includes the session identifier for an expired or abandoned session, a new session is started using the same session identifier. You can disable this by setting regenerateExpiredSessionId attribute of the sessionState configuration element to true…

…The End event is supported only when the Mode property is set to InProc.

I hope you find this information useful.

Thanks,

Miguel Bronzovic
http://blogs.southworks.net/mbronzovic

 

Feb 17, 2011 at 6:06 PM

Thanks Miguel for the prompt reply. I will give it a try. So, you don't think it has something to do with ISecurityService being a Singlton in RootContainer.Services.Get<ISecurityService>() and not resetting for each session?

I appreciate your help! Thanks.