Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

System.Web.HttpException : Session state can only be used when enableSessionState is set to true,
CoolBreeze
#1 Posted : Friday, December 7, 2018 9:01:28 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 7/11/2014(UTC)
Posts: 79
Location: United States of America

Was thanked: 9 time(s) in 9 post(s)
I realize this might be a long-shot trying to get an answer in this forum. But I have a little bit of hope that another NCrunch user ran into and solved this problem and can suggest a solution.


I posted this question in StackoverFlow:

I've reviewed all related posts on this topic in StackoverFlow and other forums.

I'm trying to test code modules which use session state using NUnit and NCrunch. So I'm not in the normal ASPX context.

In an NUnit test method:

I create a page object: Page_Obj = New Page()

Then I call a method to be tested and try to pass Page_Obj.Session.

Method_To_Be_Tested(Page_Obj.Session)

Then I get the error listed in the Subject line.

I've updated app.config with all the suggestions I could find:

<system.web>
<httpRuntime targetFramework="4.5"/>
<httpModules>
</httpModules>
<pages enableSessionState="true"></pages>
<sessionState mode="InProc"></sessionState>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="session"></remove>
<add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition=""/>
</modules>
</system.webServer>

Also, I made sure the ASP.NET Session service was running on my machine.

What else can I do to get a valid Session object in the NCrunch environment?

Thanks, Ed
Remco
#2 Posted : Friday, December 7, 2018 11:33:02 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi Ed,

My knowledge of ASP.NET in this area is quite dated, so I'm not sure how much help I can be directly on this. I'm not aware of anything the test runner specifically needs to do in order for the Session to be active ... I was under the impression that these sorts of things were usually arranged by the framework itself and/or setup code in the test.

Do you receive a different result in this test when running it with a non-NCrunch test runner? (i.e. VSTest, or the NUnit console tool).

Something worth trying if you haven't already is to try compatibility mode to see if this is being caused by an NCrunch settings related issue.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.025 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download