Hi,
if you are developing common ASP.NET web pages you have the
possibility to access the .Session or .Cache collection. Both enable
the developer to store data on the server that will be available for
later http requests.
The .Session property will be destroyed when the session is canceled.
There is a timeout configuration in web.config. The .Session
collection is only available for one user (web browser). The .Cache
collection instead can be accessed from all users, it is a web
application wide cache.
If you want to use one of these caches you have to use following code:
[AjaxMethod(HttpSessionStateRequirement.Read)]
public string SessionTest()
{
return HttpContext.Current.Session["mykey"].ToString();
}
[AjaxMethod(HttpSessionStateRequirement.Read)]
public string CacheTest()
{
return HttpContext.Current.Cache["mykey"].ToString();
}
In the case you want to add or change cache items you have to use the
HttpSessionStateRequirement.ReadWrite argument for the AjaxMethod
attribute.
Note: since version 6.6.2.1 the default is already ReadWrite, so you
do not really need this argument since this version.
--
Best regards | Schöne Grüße
Michael
Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer
http://weblogs.asp.net/mschwarz/
http://www.schwarz-interactive.de/
mailto:[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ajax.NET Professional" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/ajaxpro
The latest downloads of Ajax.NET Professional can be found at
http://www.ajaxpro.info
-~----------~----~----~----~------~----~------~--~---