Wednesday, 3 March 2010

SOLVED: Could not load type 'System.Web.UI.ScriptReferenceBase'

Getting problems when you upload your Ajax Control Toolkit powered website up to your server? Read on for a quick and easy solution!

Scenario

If you have added some of the Ajax Control Toolkit extenders into your website you will have probably tested them out on your local dev computer and marvelled at how easy it was to add some impressive eye candy to your site. Then, just when you think your work is done for the day and its time to put your new creation online you are hit with an error:

Could not load type 'System.Web.UI.ScriptReferenceBase' from assembly 'System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Well you don't need to worry too much because this time it is a really simple fix.

Quick Fix

If your site has just broken and you want to get it running quickly then the simplest solution is to change your <cc1:ToolkitScriptManager> tag to be just a plain <asp:ScriptManager> tag.

The ToolkitScriptManager is a wrapper control which provides the features of ScriptManager but also has a script combining feature to reduce the number of external javascript references generated by the toolkit.

So its as simple as taking your code

<cc1:ToolkitScriptManager runat="server" ... /> 

and changing it to

<asp:ScriptManager runat="server" ... /> 

(You might have a different prefix than cc1 but it doesn't matter).

The Real Fix

The real reason that your site is throwing the error is that the latest version of Ajax Control Toolkit expects to have a .net 3.5 SP1 runtime environment. The key bit here is the SP1 which means Service Pack 1.

To fix it you simply need to install the SP1 release which can be downloaded from here:

This needs to be run on your server so you will need remote desktop access to do this. This kind of control over your server is typically only available with dedicated servers or VPS virtual servers.

If you have a simple shared hosting package then you need to contact your web host and find out why they haven't upgraded yet. The SP1 release was a major upgrade which not only has many bug fixes included in it but also some great new features such as ASP.NET Dynamic Data. You can read all about the new features on the download link above.

In the worst case scenario where you cant get your host to upgrade and you cant move hosts because you are locked into a contract with them then you can at least fall back on the quick fix listed in the middle of this article to get your site running again.

kick it Shout it vote it on WebDevVote.com

13 comments:

Bhaskar Tripathi (hellBoy) said...

Installing DotNet framework 3.5 SP1 fixed the issue.

-Bhaskar
"It is our wits that make us men"
www.bhaskartripathi.com

Jagadeesh said...

Thaks for your solution, It solved my problem.
thanks a lot.....

Anonymous said...

Thanks for taking the time to describe the 'real' fix. Save me a ton of time.

Works a treat

Anonymous said...

Upgrading to SP1 wasn't an option for me and using the 'quick fix' with a standard with the latest build 3.5.40412.2 of the toolkit didn't render the tab container control in my case. So I reverted back to build 3.0.20229.0, uploaded it to the server and it worked fine.

Arunkumar B said...

Really usefull post. Thanks a lot

vijay kumar said...

Good post.Fixed issue.Thank you

Anonymous said...

you made my day. thanks a lot.......

Anonymous said...

Many thanks!!

hima said...

thanku very much ..,

Fercho said...

thank you very much

Bhuwan said...

My older applications are running on .net 3.5
Will it affect my older apps if I upgrde it to SP1????

Anonymous said...

Thanks^^

Nicachipal TJ said...

Well, that's what I did before reading this post. The site is not broken anymore, and I am not getting any errors, but the Ajax control are not working anymore.
I updated the frame work (4.5) and this didn't fix the error either.
So, I will have to remove unfortunately the bin folder since this is not working on the remote server. :(


-->