Cookieless Session running with Ajax.NET Professional (ASP.NET 1.1, fix for 2.0)

Michael Schwarz on Wednesday, April 5, 2006

The problem why cookieless sessions are not working in ASP.NET 2.0 is very easy, there is a change how it works internal. I have already fixed the code that it will work with ASP.NET 2.0 as with the older version 1.1. Have a look on the new release version (or higher) in the next minutes on my web site [1].

bug in ASP.NET 2.0 (it is not really a bug, it is only not working the same way when cookieless sessions is enabled) requires a change in the web.config file. Currently I have used the common system.web section. Now, I will add a location tag instead to configure the Ajax.NET Professional [1] http handler. I wrote a complete example web.config that is working for Ajax.NET Professional and added some comments directly in the web.config file.


xml version="1.0"?> <configuration> <configSections> <sectionGroup name="ajaxNet"> <section name="ajaxSettings" type="AjaxPro.AjaxSettingsSectionHandler,AjaxPro" requirePermission="false" restartOnExternalChanges="true" /> </sectionGroup> </configSections> <ajaxNet> <ajaxSettings> <urlNamespaceMappings> <!-- To hide internal knowledge of assemblies, classes and namespace you can override the name of the virtual http endpoints. <add type="Namespace.Class1,Assembly" path="mypath" /> --> </urlNamespaceMappings> <jsonConverters> <!-- This section can be used to add new IJavaScriptConverters to the Ajax.NET Professional engine. If you want to disable built-in converters you can use the remove tag. <remove type="Namespace.Class1,Assembly"/> <add type="Namespace.Class2,Assembly"/> --> </jsonConverters> <!-- Set the enabled attribute to true to get Stack, TargetSize and Source information if an exception has been thrown. --> <debug enabled="false" /> <!-- This is the default configuration used with Ajax.NET Professional. You can put there your static JavaScript files, or remove the path attribute to completly disable the files. <scriptReplacements> <file name="core" path="~/ajaxpro/core.ashx" /> <file name="prototype" path="~/ajaxpro/prototype.ashx" /> <file name="converter" path="~/ajaxpro/converter.ashx" /> </scriptReplacements> --> <!-- <encryption cryptType="" keyType="" /> --> <!-- Set the enabled attribute to true to enable the use of an Ajax.NET Professional token. This will send a token to the client that will be used to identify if the requests comes from the same PC. --> <token enabled="false" sitePassword="password" /> </ajaxSettings> </ajaxNet>

<location path="ajaxpro"> <system.web> <httpHandlers> <add verb="" path=".ashx" type="AjaxPro.AjaxHandlerFactory,AjaxPro"/> </httpHandlers> <!-- If you need to have Ajax.NET Professional methods running on the login page you may have to enable your own authorization configuration here. --> <!-- <authorization> <allow users="*,?"/> </authorization> --> </system.web> </location> </configuration>