private void OpenSession(object sender, EventArgs e) { IEmbeddedObjectContainer container = (IEmbeddedObjectContainer)HttpContext.Current.Application[DataBaseInstance]; IObjectContainer session = container.OpenSession(); HttpContext.Current.Items[SessionKey] = session; }