Groups | Blog | Home
all groups > asp.net > september 2005 >

asp.net : SessionID


Ramon Rocha
9/15/2005 9:48:57 PM
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

Pat
9/16/2005 12:00:00 AM
Try setting it in the Web.Config.
Hope that helps
Patrick

[quoted text, click to view]

Ramon Rocha
9/16/2005 10:58:14 AM
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!


"Pat" <naijacoder@hotmail.com> escreveu na mensagem
news:uLKmgvouFHA.2076@TK2MSFTNGP14.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button