How to prevent System.NotSupportedException: This method is either not marked with an AjaxMethod or is not available

Michael Schwarz on Monday, September 18, 2006

The was a discussion at the Google group about the System.NotSupportedException after changing files in App_Code folder. As there is no static assmebly name for the App_Code folder it will generated on each "rebuild" a new name that will look like very strange. The name of the assembly is used for any AjaxPro call and this will be a problem when the name changes after sending the JavaScript wrapper to the client.

To prevent this there is an option in web.config to specify type mappings. See the example below:

<ajaxSettings>
<urlNamespaceMappings>
<add type="Namespace.Classname,AssemblyName" path="mypath"/>
</urlNamespaceMappings>
</ajaxSettings>
</ajaxNet>

If you are now using methods in your App_Code folder you can use App_Code as your assembly name:

<ajaxSettings>
<urlNamespaceMappings>
<add type="Namespace.Classname,App_Code" path="mypath"/>
</urlNamespaceMappings>
</ajaxSettings>
</ajaxNet>

This will force AjaxPro to use the short name everytime instead of the changing assembly name by default.