re:
!How can I use the Session ?
Why don't you try a simple web.config, like :
------------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<pages enableSessionState = "true" />
<compilation debug="true" />
<sessionState mode="InProc" cookieless="false" timeout="20" />
</system.web>
</configuration>
----------------------------------------------------------
Check to see if it works, and then add other configuration
attributes until you find the one which is interfering ?
To check whether it's working or not, in any page, in Page_Load, set a session variable :
---------------------------------------------
<%@ Page Language="VB" %>
<script language="VB" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Session("somevar") = "somevalue"
SessionState.Text = Session("somevar")
End Sub
</script>
<html>
<head>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label id="SessionState" runat="server"/></asp:Label<br />
</div>
</form>
</body>
</html>
-----------------
....and retrieve the value in a Label in the same page.
In this example, if Session is working, you'll see the text "somevalue" returned.
Juan T. Llibre, asp.net MVP
asp.net faq :
http://asp.net.do/faq/
foros de asp.net, en español :
http://asp.net.do/foros/
======================================
"fniles" <fn****@pfmail.comwrote in message news:Oc**************@TK2MSFTNGP05.phx.gbl...
>I am using Visual Studio 2005. In my ASPX page, when I try to use Session, I got the error
"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>\<httpModulessection
in the application configuration."
In my Web.config I put the following, but still I got the error above:
<system.web>
<pages autoEventWireup="true" enableSessionState="true" enableViewState="true"
enableViewStateMac="true" smartNavigation="true" validateRequest="false">
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</controls>
</pages>
<compilation debug="true">
:
</compilation>
<httpHandlers>
:
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="Session" type="System.Web.SessionState.SessionStateModule"/>
</httpModules>
<!-- Enable in-process session state for application -->
<sessionState mode="InProc" cookieless="false" timeout="20"/>
</system.web>
How can I use the Session ? Thank you.