SQL Server 2008 session management

Discussion in 'ASP.NET 2.0' started by CrystalCMS, Jan 23, 2009.

  1. Hi all,

    I've got it working in my application, no problem and I have specified a session timeout in my web.config; so far so good. This method of session management is supported according to the knowledgebase however I've learnt that due to security, SQL Agent is not running on the discountASP.NET SQL Servers. This means that expired sessions do not get periodically automatically managed with a called to the DeleteExpiredSessions stored proc in the db.

    I do have a workaround; I can change my db so that whenever sessions are inserted with the insert procs, DeleteExpiredSessions gets called in there.

    Does anyone have any better ideas how to solve this problem in this environment? I think it has to be affecting other applications also.

    Thanks in advance,
    Joe
     
  2. Since I'm in the process of changing my session to be stored in SQLServer as well, I think a good way to go would be to create an aspx page that calls the DeleteExpiredSessions sproc and then set the page as a Scheduled Task in DASP's control panel.

    I dont know if maybe 10 minutes would be a good interval.

    Hope this helps you.
     
  3. Thanks - yes that's a valid option in the DASP environment, however I'm now leaning towards the self managed db solution for my application because:

    1) There are no dependencies on external services (the DASP scheduler) so there is potentially less to fail and have to manage.
    2) The db option will continue to work if I have to move the application and db off to some other host where running the SQL Agent may also prohibited.
    3) The most important one - it's quick and I don't have to create an aspx page solely for this purpose.

    Thanks for the heads up to the DASP scheduler though..I hadn't considered using it yet and I'm sure it will be useful.
     

Share This Page