I am working with an httpmodule ive created with the aim of keeping a users session alive with a call to an existing validatesession method in the application.
2 issues i am having is firstly i cannot seem to get the users sessionid (a static class), this sessionid is always returning as an empty guid even after it is set in the logon controller.
secondly i do not seem to be able to instantiate the class i need to call the validatesession method. we use simple injector and i am doing a new registration (as i have no constructor to pass the instance across)... but this (_useraccount) seems to always
be null....
var container = new Container();
container.Register<IUserAccount, UserAccount>();
_useraccount = container.GetInstance<IUserAccount>();
Not sure if i am utilising the right event, im using the beginrequest event in my httpmodule....
I can't make sense of this approach. The Session Id is stored in a cookie in the user's browser. Session timeout rolls when the user makes a request. A module handles HTTP request and also fires when the user makes a request. If the user is already making
a request, the module is redundant.
Why not simply increase the Session timeout in the web.config?
None
0 Points
73 Posts
HttpModule to keep a session alive
Jun 21, 2018 02:20 PM|mark1961|LINK
I am working with an httpmodule ive created with the aim of keeping a users session alive with a call to an existing validatesession method in the application.
2 issues i am having is firstly i cannot seem to get the users sessionid (a static class), this sessionid is always returning as an empty guid even after it is set in the logon controller.
secondly i do not seem to be able to instantiate the class i need to call the validatesession method. we use simple injector and i am doing a new registration (as i have no constructor to pass the instance across)... but this (_useraccount) seems to always be null....
Not sure if i am utilising the right event, im using the beginrequest event in my httpmodule....
any advice?
All-Star
53711 Points
24041 Posts
Re: HttpModule to keep a session alive
Jun 21, 2018 02:36 PM|mgebhard|LINK
I can't make sense of this approach. The Session Id is stored in a cookie in the user's browser. Session timeout rolls when the user makes a request. A module handles HTTP request and also fires when the user makes a request. If the user is already making a request, the module is redundant.
Why not simply increase the Session timeout in the web.config?
https://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate.timeout(v=vs.110).aspx
Maybe explain the problem you are trying to solve at a high level.