Geeks With Blogs

Tim Huffam Dotting the I and crossing the T of I.T.

When you reference System.Web.HttpContext.Current.Session within a class (that is not a page or control) and the method has the [AjaxPro.AjaxMethod] attribute it terminates the current execution and returns to the client.

To solve this you simply need to provide the HttpSessionStateRequrement argument to the AjaxMethod attribute - setting it to the appropriate enumeration (None, Read or ReadWrite) eg:

[AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)]
public string MyAjaxMethod(){
...
}

HTH

Tim

Posted on Wednesday, March 22, 2006 6:49 PM C# .NET , ASP.NET | Back to top


Comments on this post: Cannot access System.Web.HttpContext.Current.Session - or web app terminates, when using Ajax.net/AjaxPro.Net

# Accessing the Cache
Requesting Gravatar...
Hi, do you know if something like this has to be done for accessing the cache?? I try to put a DataTable in the cache the first time the page loads, but then, when I try to get the data, it's null. The method that does this is called through ajax.

regards, Chony.
Left by Chony on Oct 22, 2006 5:27 AM

# re: Cannot access System.Web.HttpContext.Current.Session - or web app terminates, when using Ajax.net/AjaxPro.Net
Requesting Gravatar...
if server open new Thread for set Session,
In Thread Month , the HttpContectx.Curr is Null ,colud you tell me why ?
Left by jawance on Dec 21, 2006 4:04 PM

# re: Cannot access System.Web.HttpContext.Current.Session - or web app terminates, when using Ajax.net/AjaxPro.Net
Requesting Gravatar...
CANNOT ACCESS BOBIBANKING, IT MAY SHOWN THAT BANKAWAY APPLICATION ERROR. KINDLY CHECK THE SAME AND HELP US FOR ACCESS THIS SYSTEM.

WITH THANKS & REGARDS

N.J.ENGINEERS
Left by N.J.ENGINEERS on Mar 17, 2009 9:22 PM

# re: Cannot access System.Web.HttpContext.Current.Session - or web app terminates, when using Ajax.net/AjaxPro.Net
Requesting Gravatar...
please do the needful
Left by JITENDRA HARJIVANDAS SEC PVT LTD on May 12, 2010 2:23 AM

Your comment:
 (will show your gravatar)


Copyright © Tim Huffam | Powered by: GeeksWithBlogs.net