|
|
Subject:
SessionState in ASP.NET
Category: Computers > Programming Asked by: simon_needs_help-ga List Price: $12.00 |
Posted:
19 Nov 2003 01:15 PST
Expires: 19 Dec 2003 01:15 PST Question ID: 278166 |
I have a Windows 2003 server with Visual Studio .NET installed. I create a new web application (using c# and asp.net) On the webform1.aspx I add a button from the toolbox, and in the button1_click event simply add the code: private void Button1_Click(object sender, System.EventArgs e) { Session["test"] = "123"; Response.Write(Session["test"]); } What should happen is that a button is displayed and when clicked the text 123 is rendered to screen. However, clicking the button gives error: Session state can only be used when enableSessionState is set to true, either in configuration file or in the page directive. My web.config has section <sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="20" /> My question therefore is - why is session state not working - what do I need to do to make it work? I always took it for granted!! |
|
There is no answer at this time. |
|
Subject:
Re: SessionState in ASP.NET
From: lesnikowski-ga on 23 Nov 2003 08:39 PST |
look for <%@ ... Page EnableSessionState="false" ... %> in webform1.aspx |
Subject:
Re: SessionState in ASP.NET
From: simon_needs_help-ga on 24 Nov 2003 01:02 PST |
First line of webform1.aspx is <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" EnableSessionState="true" AutoEventWireup="false" Inherits="GregBuczek.WebForm1" %> |
Subject:
Re: SessionState in ASP.NET
From: lesnikowski-ga on 24 Nov 2003 01:11 PST |
Send files .cs .aspx |
Subject:
Re: SessionState in ASP.NET
From: simon_needs_help-ga on 25 Nov 2003 00:37 PST |
Where can I send them to? |
Subject:
Re: SessionState in ASP.NET
From: nickparker-ga on 27 Dec 2003 14:32 PST |
Simon, Why don't you just open your web.config file and add the attribute enableSessionState="true". It would then look something like this: <sessionState mode="InProc" enableSessionState="true" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="20" /> Hope this helps, Nick Parker |
Subject:
Re: SessionState in ASP.NET
From: simon_needs_help-ga on 05 Jan 2004 06:13 PST |
Thanks for the reply... Modified the web config as suggested, although still getting same error: 'session state can only be used when enableSessionState is set to true either in a configuration file or in the page directive' (... which it obviously is!!) And, indeed, even doing Response.Write(Session.SessionID.ToString()); gives same error. So it is definately unhappy with session state :( Any more ideas would be appreciated! |
Subject:
Re: SessionState in ASP.NET
From: dotnetfriends-ga on 10 Mar 2004 06:08 PST |
By default it takes inproc. If u change inproc to stateserver do the following process. start -- control panel -- administrative tool --> services -- select asp.net state server by default it is stopped. start this. and try your application. |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |