1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Sitefinity overwriting HttpContext.Current.Items

Sitefinity overwriting HttpContext.Current.Items

3 posts, 0 answered
  1. Apptain
    Apptain avatar
    30 posts
    Registered:
    20 Aug 2012
    08 Dec 2011
    Link to this post
    I am using Entity Framework for my Custom MembershipProvider, and I like to attach my DataContext to a User Session when possible as per the West Wind article below but Sitefinity is consistently overwriting HttpContext.Current.Items.  Do you have any ideas on why this may be? anything I may do to prevent it? or know of another constantly present object where I may be able to store the DataContext? Once I do finally catch a debug turn where my DataContext is still in HttpContext.Current.Items I get the error "The ObjectContext instance has been disposed and can no longer be used for operations that require a connection."

    http://www.west-wind.com/weblog/posts/2008/Feb/05/Linq-to-SQL-DataContext-Lifetime-Management


  2. Viktor
    Viktor avatar
    22 posts
    Registered:
    01 Nov 2011
    08 Dec 2011
    Link to this post
    Interesting question, we would like to store some of our repositories in http context to cut down on database trips, so we'll be faced with a similar problem.
  3. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    12 Dec 2011
    Link to this post
    Hi Viktor and Joseph,

    Our custom HTTP handler disposes the .Items collection at the end of the request. You could use the Session object instead. I'm not sure how exactly do you use the Context.Items collection in your case, so code would help.

    Greetings,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
3 posts, 0 answered