简体   繁体   中英

Install AJAX without web.config?

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" %>

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM