I do it almost exactly as described in the original post for my asp.net pages, and it works fine. E.g., on one page, something like this (typed in browser from memory, please treat as pseudocode)
Code:
protected void Button1_command( object sender, CommandEventArgs e )
{
//retrieve a person and store them in the user session
int id = int.Parse( e.CommandArgument.ToString() );
ISession s = (ISession) Context.Items["NHSession"];
Person p = s.Get( typeof( Person ), id );
Session["CurrentPerson"] = p;
s.Close();
}
And on some other page, or a different event of the same page,
Code:
protected void btnSavePerson_click( object sender, EventArgs e )
{
ISession s = (ISession) Context.Items["NHSession"];
Person p = (Person) Session["CurrentPerson"];
s.SaveOrUpdate( p );
p.Name = textName.Text;
p.Age = int.Parse( textAge.Text );
s.Flush();
s.Close();
}