ASP.NET AJAX Scriptmanager error

I recently had a problem using ASP.NET AJAX where I got an error message something like this:

The base class includes the field ‘ScriptManager1’, but its type (System.Web.UI.ScriptManager) is not compatible with the type of control (System.Web.UI.ScriptManager).

I had no idea how a particular type could be incompatible with itself, so I checked Stack Overflow (easily the best question and answer site for programmers). I found a question about this problem, but none of the existing answers worked for me. I googled around a bit, and eventually solved the problem. So here’s the answer for anyone else who might have this problem:

I managed to fix it by adding this to web.config:

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
                <bindingRedirect oldVersion="" newVersion=""/>
            <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
            <bindingRedirect oldVersion="" newVersion=""/>

I believe it forces the .net runtime to use the new versions of those assemblies.

I added this to the Stack Overflow question too, for posterity. That’s one of the cool things about Stack Exchange sites, the platform encourages questions to be solved properly, once and for all, and then easily found by anyone coming later.

Obviously it helped a lot of people – my answer fast became the top answer (by far) and I earned the rare “necromancer” badge for resurrecting an old question with a popular answer.

So there you go: if you found this through searching for answers to the above problem, I hope I’ve helped you solve it. If you’re in need of answers for programming, or a heap of other things, see if there’s a stack exchange site for you. If not, propose one.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: