SessionID

  • Thread starter Thread starter Ramon Rocha
  • Start date Start date
R

Ramon Rocha

Dear friends,

Line code bellow is returning message error:
Dim strSID As String = Session.SessionID.ToString
Using <%@ Page Language="VB" EnableSessionState="True" %>

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.

web.config
<httpModules>

<add name="Session" type="System.Web.SessionState.SessionStateModule"/>

</httpModules>

Please anybody help me?

Thank you

RAMON ROCHA
from Brazil
 
My mistake was used
Dim strSID As String = Session.SessionID
.... before Sub Page_Load
The session info is not available when the class System.Web.UI.Page.... is
created

Sub Page_Load(...
Dim strSID As String = Session.SessionID

It's works!
 
Back
Top