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.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: 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.
This error usually occurs when you have declared an object variable public to the page and it access a Session variable, example:
Partial Class _Default
Inherits System.Web.UI.Page
Private m As New DBAccess(Session(“dbname”))
Protected Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Load
End Sub
End Class
#1 by Sajjad on May 19th, 2011 - 2:19 pm
Thanks, it is working and plz keep it up.
Sajjad Yousuf Anjum
from Pakistan.