Question

I've user controls project (UI) and am using AJAX Extension Toolkit with them. The dll of AJAX Extension Toolkit is referenced in the project. The project is successfully compiling.

Another project under same solution which is WSPBuilder project (Deploy). When you build UI project all the controls will be copy to Deploy project directory 12\TEMPLATE\CONTROLTEMPLATES and a dll of UI project also copied to GAC folder. (For copying, am using post-build events)

Then, build Deploy project using WSPBuilder Build and deploy. I'm getting error message:

An error occurred during the processing of . Unknown server tag 'asp:ScriptManager'.

Please, don't say that I've to manually modify the web.config to add and mark the ajax extension as a safe control. I'm not going to do that.

Any better solution?

P.S: I'm using WSPBuilder, STSDEV and VSeWSS.

EDIT

Thanks to Chris. The problem was:

In this case, I think it's other elements in web.config which you are missing - the AJAX declarations. Amongst other things, you need the following in your web.config so .Net knows how to find the ScriptManager class:

<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

But this problem goes a little weird at my side. I had to set enableSessionState to true of pages tag under system.web and uncomment the following:

<add name=”Session” type=”System.Web.SessionState.SessionStateModule” />

I thought putting AjaxExtension.dll in GAC can resolve this issue. I was avoiding to write a feature for modifying web.config. Can I do this too in manifest.xml?

Please, suggest!

Was it helpful?

Solution

The error you're seeing doesn't appear to be related to the SafeControls entry. If that was the case, you'd see a message saying "Unable to add selected web part(s). A Web Part or Web Form Control on this Page cannot be displayed or imported. The type is not registered as safe."

In this case, I think it's other elements in web.config which you are missing - the AJAX declarations. Amongst other things, you need the following in your web.config so .Net knows how to find the ScriptManager class:

<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

You have a couple of options:

  • Use the feature in the popular SharePoint Features Codeplex project which will make the web.config changes
  • Write your own code to make the web.config changes using SPWebConfigModification.

The full details of the web.config changes required are detailed here in Mike Ammerlaan's blog.

Whichever route you take, check the version of AJAX you're using against the guidance/samples you use.

OTHER TIPS

A comment from the WSPBuilder site.

Nice work! Adding third party DLLs worked great when I deployed AJAX and the AJAX Control Toolkit. I created a feature to do all the web.config changes and used the GAC\Reference folder to include the Control Toolkit DLL. Worked great even with multiple servers in the farm. That was a life saver!

So include the dll in your WSPBuilder project to get it included, then create a feature to modify web.config. See this post for information on modifying web.config with a feature.

First you have to add the assembly you want to deploy into the VS project. For example you can create a "libs" folder to store all external assemblies you'll need in your team site.

Then you have to edit the manifest.xml file of your Team Site Definition. You can find this file within the "pkg" folder within your project. Be aware that the pkg folder will only be available if you've at least deployed the solution one time.

OK, now you have to add a new <Assembly> child element to the <Assemblies> element within the manifest.xml file of your Team Definition solution. With the "DeploymentTarget" Attribute you can define whether the assembly should be deployed to the GAC or to the web application's bin folder.

The following example shows how the <Assemblies> element looks like if you want to add the "TeamSiteDefinition1.dll" to the GAC and to add the "TestSolution.dll" to the bin folder. If you need a safe control entry for your assembly you can add this one too.

<Assemblies>
    <Assembly Location="TeamSiteDefinition1.dll" DeploymentTarget="GlobalAssemblyCache" />
    <Assembly Location="TestSolution.dll" DeploymentTarget="WebApplication">
       <SafeControls>
          <SafeControl ..... />
       </SafeControls>
    </Assembly>
</Assemblies>
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top