 |
| ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

April 16th, 2004, 06:16 AM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
This way I was getting error:
"Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive"
I modified page directives in Test1.aspx then to
<%@ Page Language=" VB" EnableSessionState="true" ClassName="Test1" %>
... but the error message stays the same!
web.config sessionState by default looks like this:
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="20"
I think we are on the right way.
Thank's Reinhard
|
|

April 16th, 2004, 06:59 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
I am beginning to think there is something wrong with either the configuration of the current web site, or for the entire machine (through the Machine.Config file or through security issues (although I can't think of any right now))
Try this:
1. Create a folder C:\Test
2. Create a new Virtual Directory under your Default Web Site. Name it Test and have it point to C:\Test
3. Copy the two test files from my previous post to that folder
4. Inside that folder, create a new text file and rename it as Web.Config.
5. Add the following code to that file:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<customErrors
mode="Off" />
<authentication mode="None" />
<authorization>
<allow users="*" />
</authorization>
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="20" />
</system.web>
</configuration>
Browse to http://localhost/Test/Test1.aspx
Does that work?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Wake Up Hate by KoRn (Track 12 from the album: Untouchables)
|
|

April 16th, 2004, 07:14 AM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Imar, thank You very much until now!
I did all you said, the error message stays the same:
"Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive"
What about the machine.config? Does it overrule site settings?
Thank's Reinhard
|
|

April 16th, 2004, 07:28 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
It "underrules" site settings ;)
The Machine.Config (located here on a default installation: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFI G) defines all the default settings for all sites on your machine. Individual sites or directories can use their own Web.Config to overrule specific settings, but when an item is not defined, it will inherit it from the Machine.Config file.
In the Machine.Config you can prevent sites or folders from overruling certain settings using something like:
lockAttributes="sqlConnectionString, stateConnectionString, mode"
to prevent the mode and connectionstrings to be overruled by the sites. However, when that's the case, you get a different error message.
Just to be sure, look up the <sessionState element in your Machine.Config file and see what it says.
I am about to get out of ideas. It looks like your setup is flawed. Is reinstalling or repairing the .NET framework an option?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Makes Me Wanna Die by Tricky (Track 5 from the album: Pre-millennium Tension)
|
|

April 16th, 2004, 08:17 AM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I found this in machine.config:
<configuration>
<configSections>
<sectionGroup name="system.web">
<section name="sessionState" type="System.Web.SessionState.SessionStateSectionH andler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineToApplication"/>
...
<system.web>
<pages buffer="true" enableSessionState="true" enableViewState="true" enableViewStateMac="true" autoEventWireup="true" validateRequest="true"/>
....
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" stateNetworkTimeout="10" sqlConnectionString="data source=127.0.0.1;Integrated Security=SSPI" cookieless="false" timeout="20"/>
....
<httpModules>
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule"/>
<add name="Session" type="System.Web.SessionState.SessionStateModule"/>
..
That's it, all ok?
I am really afraid of reinstalling DotNet framework because BizTalk Server 2004 is installed on this machine and it took a lot of time to get it running. I am sure a reinstall would kill BizTalk configuration.
Reinhard
|
|

April 16th, 2004, 08:47 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
One more thing,
Do you also have Sharepoint Services installed? I came across this when searching for the error message you posted (I am quite intrigued by this problem):
http://www.visual-basic-data-mining....px?PostID=1373
Somewhere half way down the posts someone mentions WSS and provides a link to a KB article......
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Bleeding Me by Metallica (Track 7 from the album: Load)
|
|

April 16th, 2004, 09:34 AM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Yeah - you brought me on the right track.
I found
"Session state cannot be used in ASP.NET with Windows SharePoint Services"
http://support.microsoft.com/default...b;en-us;837376
Finally I solved the problem by removing Sharepoint Services from Default WebSite. Now Session is available.
Thank You very much!!!
Reinhard
|
|

April 16th, 2004, 09:41 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Great. Glad it's working now!
This is definitely one to remember.
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Fixation by Ed Rush & Optical (Track 4 from the album: Wormhole #2)
|
|

February 10th, 2005, 02:53 AM
|
|
Registered User
|
|
Join Date: Feb 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I have the same issue with Session object.
I can duplicate it, and "solve" the issue every time -
i just removed all virtual server (SharePoint) sites - and the original software works just fine.
I even created a separate web site for SharePoint, and limited it to a "non-port 80" address - it still affects all web sites and virtual servers on my machine.
I have tried using the "exclude path" from sharepoint central administration - no luck. I have set the <trust> parameters to any value you can have, and a few you cannot!
I have used a predefined application pool, and created my own - no luck, although slightly different results.
I think I smell a Bill-Gates issue.
... <chopped > ...
I only found one programmer until now who has the same problem. He didn't get any reply to his question. Maybe he's already jumped out of the 26th floor ;)
Reinhard
|
|

February 22nd, 2005, 04:27 PM
|
|
Registered User
|
|
Join Date: Feb 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I have a similiar problem to this.
I am able to set and retrieve session variables I set and call in the Page_OnLoad event, however, the ones I set in the Session_Start event don't ever seem to be set.
|
|
 |