views:

221

answers:

3

I have a weird scenario, I need to use the AJAX ScriptManager and UpdatePanel on two specific ASP.NET 2.0 pages. The pages are in their own second-level directory (we don't want to make that directory a Virtual Directory). The root web.config is not AJAX enabled, and we don't want to change it.

Is is possible to use AJAX here, and how?

I was hoping it might be as easy as :

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
+1  A: 

Is it an option for you to add a "local" web.config file in the sub directory in question? If you do so, all tags that are not present in the "local" file will be read from the "root" file.

Tomas Lycken
Except tags that are registered as `machineToApplication`.
SLaks
This and a combination of SLaks answer - was able to easily create a subdirectory web.config. Thanks!
rlb.usa
+1  A: 

I believe you can create a web.config in your target folder that overrides the settings of the global web.config in the application root.

See http://www.codeproject.com/KB/aspnet/multipleWebConfig.aspx

Mind you, I haven't tried this with tag registration, so YMMV.

David Lively
+1  A: 

You need to add a reference to System.Web.Extensions.dll to the application; without that, I'm pretty sure it's completely impossible.

However, if you just add a reference to that assembly to the root Web.config (without changing anything else), you should be able to register the tag prefix in your ASPX files, like this:

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

I haven't tried it, though.

Please note that if the server isn't running .Net 3.5, you'll need to copy System.Web.Extensions.dll to the application's Bin folder.

SLaks