Copied to clipboard

Flag this post as spam?

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


  • bayshield 50 posts 65 karma points
    Oct 03, 2009 @ 09:49
    bayshield
    0

    Accessing Session State in User Control

    Hi,

    I have a very simple user control that sets a session variable, however when I host it in umbraco I am getting the following error:

     

    Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive.

    I have updated the  web.config as follows however the error still occurs.  I am running IIS7.

    <sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="20" />
    <pages enableEventValidation="false" enableSessionState="true">

     

    Any ideas?

     

    Thanks,

    Aaron

     

  • Peter Gregory 407 posts 1612 karma points MVP 3x admin c-trib
    Oct 03, 2009 @ 11:12
    Peter Gregory
    1

    what version of IIS are you using?   If you are using IIS7 with extensionless URLs you will need to modify the modules tag in the IIS7.  For some reason with extensionless URLs the Session State does not get initialized.  To ensure that the Session State is initialized everytime you need to add runAllManagedModulesForAllRequests="True" to the modules tag in the system.webServer section of the web.config II7.  it should look like this.

    <modules runAllManagedModulesForAllRequests="True">

    Hope that sorts out your problems.

    Peter

    .

  • moseeds 13 posts 29 karma points
    Dec 08, 2009 @ 15:09
    moseeds
    0

    Brilliant I had the same problem completely overlooked this directive. thanks.

  • Razvan 36 posts 67 karma points
    Dec 10, 2010 @ 14:49
    Razvan
    0

    Thanks, you just saved my day :)

  • Lars 66 posts 136 karma points
    Dec 21, 2010 @ 14:01
    Lars
    0

    Sounds very fine and it deserves a try! But can somone please tell me where to find the web.config file in installed Umbraco!

  • Lars 66 posts 136 karma points
    Jan 05, 2011 @ 11:44
    Lars
    0

    Pls note: Don't type "True", type "true" indstead. "True" returns the error: "

    <modules runAllManagedModulesForAllRequests="True"> to <modules runAllManagedModulesForAllRequests="true">
  • Amigo 231 posts 506 karma points
    Jan 12, 2011 @ 15:11
    Amigo
    0

    I have the same problem,  but my site is hosted and i dont have access to iis config..
    Is there any methods to fix/override it in the umbraco web.config?

  • Lars 66 posts 136 karma points
    Jan 12, 2011 @ 15:21
    Lars
    0

    My problem is still not fixed. But it sounds interesting to me if Umbraco simply overrides my connection string. I have tried with real many combinations including the one used by my Visual Web Developer. Nothing works!

     

  • Amigo 231 posts 506 karma points
    Mar 15, 2011 @ 18:31
    Amigo
    0

    anyone with ideas here?

  • kashif 18 posts 38 karma points
    May 02, 2011 @ 17:04
    kashif
    0
    runAllManagedModulesForAllRequests="True" this keyword has performance issues as well so keep in mind.
Please Sign in or register to post replies

Write your reply to:

Draft