FIXED: Mono & BlogEngine - Session Variables & Timeouts

Aug 19, 2008 at 1:17 AM
I know this issue has been raised here before but without any answers. First off I am running the following:
  • Ubuntu 8.04
  • Mono 1.9.1
  • MySQL 5.0
  • Apache 2.2 (mod_mono)
  • BlogEngine.NET 1.4.5
Everything is working great except when I am logged for more than 10 minutes and I proceed with some benign action like save a post I am working on.  I receive the following error:

Server Error in '/' Application

Object reference not set to an instance of an object

Description: HTTP 500. Error processing request.

Stack Trace:

System.NullReferenceException: Object reference not set to an instance of an object
at System.Web.Security.RolePrincipal.IsInRole (System.String role) [0x00000]
at BlogEngine.Core.Web.Controls.BlogBasePage.OnLoad (System.EventArgs e) [0x00000]
at System.Web.UI.Control.LoadRecursive () [0x00000]
at System.Web.UI.Page.ProcessLoad () [0x00000]
at System.Web.UI.Page.ProcessPostData () [0x00000]
at System.Web.UI.Page.InternalProcessRequest () [0x00000]
at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000]

Version information: Mono Version: 2.0.50727.42; ASP.NET Version: 2.0.50727.42

It is as if a timeout expired and my session variables were cleared.  Refreshing the page does nothing and I usually have to close the browser, restart the browser, go back to my site and log back in. I haven't made any modifications to the Web.Config other than to make it work with MySQL (which it does).  I have read that there are problems with IIS recycling the application pool that cause this type of error, however, I am not using IIS.  If anyone is running a similar setup to mine and knows a tweak to make the problem go away, I would be grateful.
Aug 19, 2008 at 8:00 PM
Edited Aug 19, 2008 at 8:48 PM
I tried adding a sessionState element to the Web.Config and the session was still cleared after 20min (same error as above).  Changing the timeouts has no effect, anyone have any idea what is going on here?  I did find that a number of old cookies are left behind when the error occurs and if I delete them in the browser and refresh the URL the application comes back without an error.

Important bits of my Web.Config:

 <authentication mode="Forms">

  <sessionState mode="InProc" timeout="120"/>
Aug 20, 2008 at 12:13 AM
The .BLOGENGINEROLES cookie was expiring causing the error.  I set the cookieTimeout attribute for the roleManager element in Web.Config as follows:


I was able to login and work for over an hour without any issues!