Hi,
I had a look into what you could have meant and you say you're using
HttpContext. Indeed, in some places HttpContext.Current.Session is null. I
haven't tested on IIS, but on the built in server, at least, there's no
instance of SessionState, until you have started processing a request.
What that means is that during the handler selection phase, where
MonoRailHttpHandlerFactory is being run and hopefully finds a controller in
the IControllerTree, there will not be a session, so if you're trying to
access it in a handler, then this is why.
It's not until you have bound the request to a handler, that the
SessionState object is there for you, but the first thing MonoRail's
BaseHttpHandler does is to fill the session:
/// <summary>
/// Performs the base work of MonoRail. Extracts
/// the information from the URL, obtain the controller
/// that matches this information and dispatch the execution
/// to it.
/// </summary>
/// <param name="context">The context.</param>
public virtual void Process(HttpContext context)
{
BeforeControllerProcess(context);
And
/// <summary>
/// Handles MonoRail's actions before the controller action
started processing
/// </summary>
/// <param name="context">The context.</param>
protected void BeforeControllerProcess(HttpContext context)
{
if (!sessionless)
// Now we have a session
engineContext.Session =
ResolveSession(context);
So when you get to your controller, you'll have your session. Otherwise,
store it in HttpContext.Current.Items.
If you are in DIRE need of your SessionState, then if you use reflection
when web application is running; it's under the key "AspSession" in
HttpContext.Current.Items.
Regards,
Henrik
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Kcube
Sent: den 13 maj 2009 09:18
To: Castle Project Users
Subject: How to store session object with monorail?
Hi,
I am new to monorail, sorry for asking the basic question.
How to store session object with monorail?
I have seen that the session object is handled in httpcontext. but i cant
access httpcontext every where in the project. its showing null.
ie in base cass.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---