Creating a Page object with session outside of browser

M

mypetrock

I'm trying to unit test some of my ASP .NET code that gets data from a
Page object's Session property. I want to be able to test this outside
of a browser, but I keep getting the error:

System.Web.HttpException : Session state can only be used when
enableSessionState is set to true, either in a configuration file or in
the Page directive. Please also make sure that
System.Web.SessionStateModule or a custom session state module is
included in the <configuration>\<system.web>\<httpModules> section in
the application configuration.

I've tried starting the ASP.NET State Server and changing the
machine.config and app.config to enable Session State:

<system.web>
<sessionState mode="StateServer"
stateConnectionString="localhost:42424" />
</system.web>

But no dice.

Any thoughts?

mypetrock
 
B

bruce barker \(sqlwork.com\)

your unit test could inherit from the page and implement session management,
using a mocker

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top