Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Markus Johansson 1930 posts 5858 karma points MVP 2x c-trib
    Feb 22, 2013 @ 12:18
    Markus Johansson
    0

    (V6.0.0) Session object is always null

     

     I'm working on an upgrade from an Umbraco 4.0.2 instance to 6.0.0 and are having problem with the Session object. 


    The session object can be used "on the page", for example this inline razor macro works in a my master template:

    <umbraco:Macro runat="server" language="cshtml">
    @{
     HttpContext.Current.Session["test"] ["test"] = "Hey";
    }

    Value: @ HttpContext.Current.Session["test"] ["test"].ToString();
    </umbraco:Macro>


    But in the custom role provider that's implemented in the solution the exact same line of code don't work. The session object will be null.

    I have read all these posts in the forum and can't find a way around this:


    http://jgvimalan.wordpress.com/2011/05/31/httpcontext-current-return-null-in-iis-7/

    http://stackoverflow.com/questions/218057/httpcontext-current-session-is-null-when-routing-requests

    This settings is by there by default in V6:

    <modules runAllManagedModulesForAllRequests="True">

     I've also tried this: 

     

        <modules runAllManagedModulesForAllRequests="True">
            
            <remove name="Session" />
            <add name="Session" type="System.Web.SessionState.SessionStateModule"/>
    

     

    Anyone who know what I could try more?



  • Niels Lynggaard 192 posts 550 karma points
    May 02, 2014 @ 13:24
    Niels Lynggaard
    0

    Any solutions to this? I'm having sort of a similar problem.

    I'm trying to use Session in a httpmodule on Umbraco 6.1.6 that is running in MVC rendering.

    The HttpContex.Current.Session object is always null in my module.

    I've added the lines above to web.config and I've made the module implement the IRequiresSessionState interface.

    Still no luck :(

    Any help greatly appreciated, I'm slowly going nuts here..

  • Charles Afford 1163 posts 1709 karma points
    May 04, 2014 @ 19:27
    Charles Afford
    0

    have you debugged and looked at what the custom proider object contains?  Have you checked the session for the keys?

    Charlie :)

Please Sign in or register to post replies

Write your reply to:

Draft