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

Posted: Tuesday, December 27, 2011 in .NET, asp.net

In my web project for all the pagers I was inheriting from base page. Then I realize that in VS it gives and error in HTML design mode saying  “Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive.”

The issue was that I was using session object in the OnInit method in my base class.so then I move my code to OnLoad mothod and then in VS the rendering error disappeared.

BTW in first scenario also when I run the code it worked well.

Advertisement
Comments
  1. [...] Session state can only be used when enableSessionState is set to true, either in a configuration fil… [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s