Web.Config Modifications for Ajax / .Net 3.5 support 

I've seen at least 3 projects that attempt to eliminate the otherwise cumbersome hassle of editing the web.config file, which needs to be modified in order to allow the use of Ajax. While I appreciate the effort others have taken with these projects, it was also a bit frustrating because none of them were flawless. Amongst the SharePoint Features project on Codeplex is the 3.5.Config for instance, which does work when you install it, but when you deinstall it later it deletes the entire "<pages /> section and also seemed to "confuse" the Web Services of my SharePoint installation, causing all further install attempts to modify the web.config file to fail.
 
To be fair though, the Microsoft documentation on this topic is quite sparse (to say it politely), so it's not that easy to get to the bottom of these problems.
 
Well, I just happened to be in need for such a solution again and as it is simply too much hassle to modify the web.config manually (especially when you have to modify it on multiple Web Frontends), I just took the time once more to see if anyone had come up with some inspiration...
 
As luck had it, I found some good stuff in the SharePoint guidance project on Codeplex. This project has quite some depth to it, so I decided to "extract some good approaches" that addressed what I needed for my project (hey, I think Picasso once said that creativity is nothing more than clever copying from different sources ;-)
 
I've tested my solution on a couple of installs so far, and it seems to work fine. I'll keep testing it some more, but also thought that someone else might want to use it right away. So, here's the download link to the .wsp file for this solution. Feel free to use it AT YOUR OWN RISK and let me know if you have problems, or whether it worked for you.
 
P.S. Kudos to everyone involved in the SharePoint Guidance project!
 
Update (23-AUG-09): Thanks to Ernst Joss I've found and fixed a problem with this solution: whenever the <controls> section already existed, the tagprefix line was not added. And afterwards, when deactivating the feature, the whole <controls> section, potentially including other content, was deleted.
 
I've split the respective web.config modification now into two parts: one EnsureSection entry for the <controls> section, and a separate EnsureChildNode entry for adding the tagprefix line.
 
The download link above has the updated 1.0.1 version of the wsp.
 
Posted on 30-Jun-09 by Jennifer Neumann
11 Comments  |  Trackback Url  |  Link to this post | Bookmark this post with:        
Tags: Sharepoint
 

Comments

Wednesday, 29 Jul 2009 09:20 by Ernst Joss
Hi Jen As I do some research in enabling ajax as well to sharepoint, I've found your post. Exactly as you mentioned, the solution from Steven Van de Craen does not completely remove the assembly-bindings ending it adding again and again. Your approach is, to leave this completely away. Does this work? I guess if you do have some functionalities based on the "old" system.web.extension dll these redirections are needed? Do you have any hints or experience? By the way: you're also missing the controls section with the tagprefix "asp".

Wednesday, 29 Jul 2009 02:03 by Jen
Hi Ernst, I didn't test this solution against the "old" (Version 1.0.61025.0) System.Web.Extension. But when you look at the "Configuring ASP.NET AJAX" page (http://www.asp.net/AJAX/documentation/live/ConfiguringASPNETAJAX.aspx) you'll see that those additional lines Steven has in his solution are not mentioned there. I might not understand your comment about "missing the controls section". Just to double check: are you referring to the following section: <add tagPrefix="asp" namespace="System.Web.UI... >? This is in the wsp that can be downloaded and should show up in the web.config. If you open the FC.EnableAjax.dll with Reflector you can find it in the "FC.EnableAjax.Properties.Resources.resources" which are in the Resources folder under the Name "WebConfigModControls".

Thursday, 30 Jul 2009 11:07 by Ernst Joss
Hi Jen, Thanks for your feedback. So I will leave these assembly bindings away till I will be in troubles ;-) And yes, I meant exactly this entry <add tagPrefix="asp" namespace="System.Web.UI... >;. You're right, it's added correctly on the config file, but just if you don't have any controls-section already be there. The path to this section is <pages...><controls> <add tagPrefix...>;. If the <controls> is already there, it will be skipped, and on deactivating the whole <controls>-section will be removed (leading to adding it later again during activating). But what if you have other statements in this <control> section? This just for you're information. You'll surely know wether you have to update you're code or not in your cases.

Thursday, 30 Jul 2009 11:53 by Jen
Hi Ernst, yes, I am a firm believer of "less is more" ;-) ...unless I have a clear need for adding something to the web.config I prefer to leave things out. Thanks for letting me know about the problem with the controls section. I'll look into that, but can't promise a timeframe for doing so, as I am currently busy with something else.

Sunday, 23 Aug 2009 08:05 by Jen
Hi Ernst, I just found the time to check ...and yes, you're right: there was a problem when the controls section already existed. I've fixed the solution and will post an update here shortly with the new wsp file. Thanks for finding this problem!

Tuesday, 6 Oct 2009 04:04 by Tim
Thanks for providing this. Is there any way you can provide the source code that you used to make the DLL?

Tuesday, 6 Oct 2009 11:41 by Jen
Hi Tim, the source code is accessible simply by opening the downloaded .wsp file (e.g. with WinRAR) and then opening the dll with Reflector (I've not protected the dll in any way). I decided not to post source code here because all the xml for the web.config is in the Resources (equally accessible via Reflector in the dll). If you send me your email address via my contact form I'll be happy to send you the complete VS solution (source code & resources).

Friday, 11 Dec 2009 09:50 by Derek
I cant seem to download the wsp from the following link (http://blogs.sharepointdam.com/jen/Downloads/FC.EnableAjax.wsp), is it still available ?

Friday, 11 Dec 2009 12:22 by Jen
Derek, I’m not sure what went wrong that prevented the download to start. Maybe your browser setting are preventing it. If you send me your email through the contact form on this blog I'll email you the wsp back.

Saturday, 12 Dec 2009 01:27 by Jen
Derek, I also just thought that you might simply try to right-click the link and then choose Save Target as... I've tried c licking it and right-clicking it and all works fine.

Wednesday, 16 Dec 2009 12:10 by Derek
I got it working, turns out a download manager was capturing my downloads and doing everything in the background. So I got the wsp and its great the best i have found anywhere, so thanks for your efforts.I tryed something similar and it turned out to be a lot more complicated than I thought it ever could be.

Name:
URL:
Email:
Comments:

CAPTCHA Image Validation