Hope I do not make you angry with my daily questions!!

I have followed all advices. Everything works fine and SessionScope
seems to be worked fine. but I still have "Session Closed!" error. I
get this error exactly when the logined page will appear after login!

The reason that I got through debug is "Membership Provider". this
OoTB approach need default constructor, and DI needs another
constructor for DI objects, the problem begins here. Membership
Provider initialized (default ctor) by ASP .NET MVC oOTB membership
approach and when the user will log in Membership provider initializes
via DI (ctor with DI objects) again that I guess the older session is
no more active.

tired of these conflicts and lack of my knowledge to solve it :-S

Any idea?

Thanks once again and again
/Sheri

On 27 Jan, 16:20, Jason Meckley <[email protected]> wrote:
> you lost me :) i think I get it, but want to be sure.
> 1. you are subclassing asp.net MembershipProvider
> 2. your implementation utilizes ISession
> 3. your implementation isn't registered in the container and therefore
> cannot be resolved automatically
>
> I haven't used the MembershipProvider explicitly. The apps I create
> are intranet apps on a Windows Domain. We utlize windows
> authentication, so I'm haven't had to explicitly control the login
> process.
>
> can you post the relevant code for the provider (and associated
> objects)? We should be able to get this to work.
>
> On Jan 27, 9:00 am, Sheri <[email protected]> wrote:
>
>
>
> > Jason, thanks again for your quick answer!
>
> > All of component who injects session are transient.
> > The only thing that I can guess is "MembershipProvider" in ASP .NET
> > MVC. I cannot register it as a component. and since I user one of my
> > services in my costumized provider I should register this one as a
> > transient component too but I cannot do.
>
> > Is it true? what can I use instead of OoTB "Membership Provider" in
> > ASP .NET MVC 1.0?
>
> > /Sheri
>
> > On 26 Jan, 22:32, Jason Meckley <[email protected]> wrote:> if you are 
> > injecting the session into a service, the service must be
> > > Transient, also with objects that utilize these service must be
> > > transient. here are some examples
>
> > > controller > dao > session. all must be transient
> > > controller > service
> > >               > dao > session. controller and dao must be transient,
> > > service can be a singleton, if necessary.
>
> > > by default component lifestyles are "undefined" which defaults to
> > > singletons.
>
> > > On Jan 26, 3:54 pm, Sheri <[email protected]> wrote:
>
> > > > ______________________
> > > > By the way the error message is (sorry for swedish language in the
> > > > message):
>
> > > > System.ObjectDisposedException was unhandled by user code
> > > >   Message="Session is closed!\r\nObjektnamn: ISession."
> > > >   Source="NHibernate"
> > > >   ObjectName="ISession"
> > > >   StackTrace:
> > > >        vid NHibernate.Impl.AbstractSessionImpl.ErrorIfClosed()
> > > >        vid
> > > > NHibernate.Impl.AbstractSessionImpl.CheckAndUpdateSessionStatus()
> > > >        vid NHibernate.Impl.SessionImpl.CreateCriteria(Type
> > > > persistentClass, String alias)
> > > >        vid
> > > > WebMonitorUpdate.Models.NHDataAccessObjects.OnlineSystemDAO.findByUsername
> > > > (String username) i C:\Projects\WebMonitorUpdate\WebMonitorUpdate
> > > > \Models\NHDataAccessObjects\OnlineSystemDAO.cs:rad 55
> > > >        vid
> > > > WebMonitorUpdate.SQLServerServices.OnlineSystemService.getCustomerInfoByNam
> > > >  e
> > > > (String username) i C:\Projects\WebMonitorUpdate\WebMonitorUpdate
> > > > \SQLServerServices\OnlineSystemService.cs:rad 33
> > > >        vid
> > > > WebMonitorUpdate.MembershipServicesImpl.SQLServerMembershipProvider.Validat
> > > >  eUser
> > > > (String usernameAndSystemId, String password) i C:\Projects
> > > > \WebMonitorUpdate\WebMonitorUpdate\MembershipServicesImpl
> > > > \SQLServerMembershipProvider.cs:rad 139
> > > >        vid
> > > > WebMonitorUpdate.MembershipServicesImpl.AccountMembershipService.ValidateUs
> > > >  er
> > > > (String systemId, String userName, String password) i C:\Projects
> > > > \WebMonitorUpdate\WebMonitorUpdate\MembershipServicesImpl
> > > > \AccountMembershipService.cs:rad 32
> > > >        vid WebMonitorUpdate.Validators.AccountValidators.ValidateLogOn
> > > > (String systemId, String userName, String password, IMembershipService
> > > > membershipService, ModelStateDictionary modelState) i C:\Projects
> > > > \WebMonitorUpdate\WebMonitorUpdate\Validators\AccountValidators.cs:rad
> > > > 50
> > > >        vid WebMonitorUpdate.Controllers.AccountController.LogOn(String
> > > > systemId, String userName, String password, Boolean rememberMe, String
> > > > returnUrl) i C:\Projects\WebMonitorUpdate\WebMonitorUpdate\Controllers
> > > > \AccountController.cs:rad 70
> > > >        vid lambda_method(ExecutionScope , ControllerBase , Object[] )
> > > >        vid System.Web.Mvc.ActionMethodDispatcher.Execute
> > > > (ControllerBase controller, Object[] parameters)
> > > >        vid System.Web.Mvc.ReflectedActionDescriptor.Execute
> > > > (ControllerContext controllerContext, IDictionary`2 parameters)
> > > >        vid System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod
> > > > (ControllerContext controllerContext, ActionDescriptor
> > > > actionDescriptor, IDictionary`2 parameters)
> > > >        vid
> > > > System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClassa.<InvokeActionMeth
> > > >  odWithFilters>b__7
> > > > ()
> > > >        vid
> > > > System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter
> > > > (IActionFilter filter, ActionExecutingContext preContext, Func`1
> > > > continuation)
> > > >        vid
> > > > System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClassa.<>c__DisplayClass
> > > >  c.<InvokeActionMethodWithFilters>b__9
> > > > ()
> > > >        vid
> > > > System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters
> > > > (ControllerContext controllerContext, IList`1 filters,
> > > > ActionDescriptor actionDescriptor, IDictionary`2 parameters)
> > > >        vid System.Web.Mvc.ControllerActionInvoker.InvokeAction
> > > > (ControllerContext controllerContext, String actionName)
> > > >        vid System.Web.Mvc.Controller.ExecuteCore()
> > > >        vid System.Web.Mvc.ControllerBase.Execute(RequestContext
> > > > requestContext)
> > > >        vid
> > > > System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute
> > > > (RequestContext requestContext)
> > > >        vid System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase
> > > > httpContext)
> > > >        vid System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext
> > > > httpContext)
> > > >        vid
> > > > System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest
> > > > (HttpContext httpContext)
> > > >        vid System.Web.Mvc.MvcHttpHandler.VerifyAndProcessRequest
> > > > (IHttpHandler httpHandler, HttpContextBase httpContext)
> > > >        vid System.Web.Routing.UrlRoutingHandler.ProcessRequest
> > > > (HttpContextBase httpContext)
> > > >        vid System.Web.Routing.UrlRoutingHandler.ProcessRequest
> > > > (HttpContext httpContext)
> > > >        vid
> > > > System.Web.Routing.UrlRoutingHandler.System.Web.IHttpHandler.ProcessRequest
> > > > (HttpContext context)
> > > >        vid WebMonitorUpdate._Default.Page_Load(Object sender,
> > > > EventArgs e) i C:\Projects\WebMonitorUpdate\WebMonitorUpdate
> > > > \Default.aspx.cs:rad 18
> > > >        vid System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr
> > > > fp, Object o, Object t, EventArgs e)
> > > >        vid System.Web.Util.CalliEventHandlerDelegateProxy.Callback
> > > > (Object sender, EventArgs e)
> > > >        vid System.Web.UI.Control.OnLoad(EventArgs e)
> > > >        vid System.Web.UI.Control.LoadRecursive()
> > > >        vid System.Web.UI.Page.ProcessRequestMain(Boolean
> > > > includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
> > > >   InnerException:
>
> > > > ______________________
>
> > > > On 26 Jan, 21:41, Sheri <[email protected]> wrote:
>
> > > > > Thanks a lot Jason for you help.
> > > > > Sorry for my disturbance.
>
> > > > > ((just a point to them who would like to use NH 2.1.2.4000 and latest
> > > > > Castle versions, NHibernate.ByteCode.Castle source code should be
> > > > > built by the latest version of Castle.Core and Castle.DynamicProxy2.))
>
> > > > > I use IHttpModule to open/close session  but I get "Session Closed"
> > > > > error.
>
> > > > > 1. web.config: I have current_session_context_class = web & <add
> > > > > name="SessionScope" type="MyPackage.Helper.SessionScope, MyPackage"/>
> > > > > in my httpModule section
> > > > > 2. I have a daoFactory which is registered in container. this
> > > > > daoFactory initialize all my DAOs. (But I do not have registered my
> > > > > dao in the container directly. DAO classes are for CRUD operation)
> > > > > 3. I have some services classes which has some dao as object for other
> > > > > process with retrieved data from DAOs. In these services classes I
> > > > > have initialized each dao through daofactory
> > > > > 4. All my daos is inserted in castle section of web.config
>
> > > > > I do not know why I get "session closed error". The only thing I can
> > > > > guess is registration in container which I have some trouble to
> > > > > understand.
> > > > > SessionScope (that implements IHttpModule) should retrieve and close
> > > > > session byself? or?
>
> > > > > Thanks for any help
>
> > > > > Regards
> > > > > Sheri
>
> > > > > On 25 Jan, 14:49, Jason Meckley <[email protected]> wrote:
>
> > > > > > Sheri, this has been my approach with registering NH in Windsor.
>
> > > > > > public NhibernateFacility : AbstractFacility
> > > > > > {
> > > > > >         public override void Init()
> > > > > >         {
> > > > > >                 var configuration = new Configuration().Configure();
> > > > > >                 var factory = configuration.BuildSessionFactory();
> > > > > >                 
> > > > > > Kernel.AddComponentInstance("nhibernate_configuration",
> > > > > > configuration);
> > > > > >                 Kernel.AddComponentInstance("session_factory", );
> > > > > >                 
> > > > > > Kernel.Resolvers.Add(NhibernateSessionResolver(Kernel));
> > > > > >                 //I could also use the factory method to resolve 
> > > > > > the session, but
> > > > > > that can cause a memory leak if i don't also implement
> > > > > >                 //a custom lifecyle for it. It's easier just to 
> > > > > > resolve the session
> > > > > > with sub dependency resolver.
> > > > > >                 //It's also easier to test in isolation.
> > > > > >         }
>
> > > > > > }
>
> > > > > > public NhibernateSessionResolver : ISubDependencyResolver
> > > > > > {
> > > > > >         private readonly IKernel kernel;
>
> > > > > >         public NhibernateSessionResolver(IKernel kernel)
> > > > > >         {
> > > > > >            ...
>
> läs mer »

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" 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/nhusers?hl=en.

Reply via email to