session not available when using AJAX

Posted on 2006-03-30
Last Modified: 2008-02-01

i'm trying to call a session that i create on my first page let call it session("test1") this session contains an array lets call it ar1. I am trying to call my ajax function located on "AjaxFunctions.vb" call "ParseArray" everything goes well untill i try to get the info inside my session. all i get is "Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive", now session state is turned on, the page that contains the ajaxfunction also has the enablesessionstate="true" flag. What am i doing wrong.

Question by:VBSMerlin
    LVL 12

    Expert Comment


    Did you try setting it in Web.Config?
    All are you using Sharepoint Services or FreeToolBox?
    LVL 1

    Author Comment

    this is the linbe in my web config

    <sessionState mode="InProc" stateConnectionString="tcpip=" sqlConnectionString="data source=;Trusted_Connection=yes"
                      cookieless="false" timeout="60" />
    LVL 1

    Author Comment

    Figured it out for anyone else that might ever get this problem here is the solution to AJAX and Session State

    If you ever get in your AJAX function an error stating that the session is null. Add the following handler in front of your Function that will resolve the issue

    <Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)> _
    Public Function SomeFunction() As String
      'your code here
      Return aString
    End function

    Accepted Solution

    PAQed with points refunded (500)

    Community Support Moderator

    Featured Post

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now