• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 766
  • Last Modified:

session not available when using AJAX


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.

  • 2
1 Solution

Did you try setting it in Web.Config?
All are you using Sharepoint Services or FreeToolBox?
VBSMerlinAuthor Commented:
this is the linbe in my web config

<sessionState mode="InProc" stateConnectionString="tcpip=" sqlConnectionString="data source=;Trusted_Connection=yes"
                  cookieless="false" timeout="60" />
VBSMerlinAuthor Commented:
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
PAQed with points refunded (500)

Community Support Moderator
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now