Anthem.NET and .NET 4.0

Solution for making Anthem.NET works in .NET 4.0 project.

Problem

Anthem.NET Ajax library written by Jason Diamonds supports only ASP.NET 1.1 and ASP.NET 2.0. This library is totally depending on the classic client id generation. When we upgraded our project to .NET 4.0, we found that the pages that use Anthem.NET doesn’t work anymore.

Please refer to the following links below to see ASP.NET 4.0 breaking changes.

ASP.NET 4.0 breaking changes

ClientIDMode.

Solution

The solution for this issue is very simple. You can set the compatibility mode to 3.5 in web.config and then Anthem.NET will work without changing anything.

Here is the code that you copy.


<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">

<controls>

<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

</controls>

</pages>

Download

I converted the existing project to .NET 4.0 as well. You can download it from the link below.

6 thoughts on “Anthem.NET and .NET 4.0

  1. Thanks for the post, Michael! However, this isn’t quite working for me. I’m getting an “Invalid postback or callback argument” error in the AJAX response form the server (i.e. I only see this error when I look at the response in Firebug, otherwise it appears that nothing is happening). The only “solution” I’ve found is to disable event validation at the page or application level (via the Web.config file), but that really isn’t a solution. Have you run into this before?

  2. Michael, thanks a lot! I’m migrating a .Net 1.1 solution (+/-60 projects) to .Net 4.5 including several projects with Anthem Controls. I first only updated the Web.config file as suggested but got the same problem as Aaron. Then I saw that you converted the Anthem project to .Net 4.0. So I integrated your Anthem-2010 project in my solution and now everything is working again as in the .Net 1.1 solution.
    With this solution I don’t need to replace all the Anthem controls by ASP.NET AjaxControlToolkit controls. This saves me a lot of work.
    Thanks again.

  3. Your welcome, Dirk! :)

    Hi Aaron,

    It works for our project. If you can manage to send the example that doesn’t work after changing the web.config then I will take a look at it.

Leave a Reply

Your email address will not be published. Required fields are marked *