Adding ATLAS to an Existing Web Application

Recently had to add ATLAS to an existing ASP.NET 2.0 application and found that there is more to it than simply adding a reference to the Microsoft.Web.Atlas.dll.

I tried registering the assembly in an <@ Register> tag after adding the reference but still had errors that the atlas: tags where not known - missing assembly. So something else was missing.

Comparing the web.config revealed several missing entries required to plumb in the Atlas libraries.

So my receipe to add Atlas is as follows:

1. Add the Microsoft.Web.Atlas.dll either manually or via adding the AtlasToolkit components to the toolbox.

2. Add the following lines to the web.config under the configuration root node.

        The configSections define a section for ASP.NET Atlas.
    <sectionGroup name="microsoft.web" type="Microsoft.Web.Configuration.MicrosoftWebSectionGroup">
      <section name="converters" type="Microsoft.Web.Configuration.ConvertersSection" requirePermission="false" />
      <section name="webServices" type="Microsoft.Web.Configuration.WebServicesSection" requirePermission="false" />
      <section name="authenticationService" type="Microsoft.Web.Configuration.AuthenticationServiceSection" requirePermission="false" />
      <section name="profileService" type="Microsoft.Web.Configuration.ProfileServiceSection" requirePermission="false" />

      The microsoft.web section defines items required for the Atlas framework.
      <add type="Microsoft.Web.Script.Serialization.Converters.DataSetConverter"/>
      <add type="Microsoft.Web.Script.Serialization.Converters.DataRowConverter"/>
      <add type="Microsoft.Web.Script.Serialization.Converters.DataTableConverter"/>
    <webServices enableBrowserAccess="true" />
      Uncomment this line to enable the authentication service.
    <authenticationService enabled="true" />

    <!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved 
         and modified in Atlas applications, you need to add each property name to the setProperties and 
         getProperties attributes.  If you intend for all properties to be available, you can use "*"
         as a shorthand rather than enumerating each property  -->
    <profileService enabled="true" 
                    getProperties="propertyname1;propertyname2" />


I have included the commented sections found in the default web.config. You may already have some settings in these sections so watch out you don't overwrite or duplicate a section.

3. Add the following under the system.web node.

        <add namespace="Microsoft.Web.UI" assembly="Microsoft.Web.Atlas" tagPrefix="atlas"/>
        <add namespace="Microsoft.Web.UI.Controls" assembly="Microsoft.Web.Atlas" tagPrefix="atlas"/>
          Set compilation debug="true" to insert debugging 
          symbols into the compiled page. Because this 
          affects performance, set this value to true only 
          during development.
    <compilation debug="false">
          <add extension=".asbx" type="Microsoft.Web.Services.BridgeBuildProvider" />

          ASMX is mapped to a new handler so that proxy javascripts can also be served.
      <remove verb="*" path="*.asmx"/>
      <add verb="*" path="*.asmx" type="Microsoft.Web.Services.ScriptHandlerFactory" validate="false"/>
          The MultiRequestHandler enables multiple requests to be handled in one
          roundtrip to the server. Its use requires Full Trust.
      <add verb="*" path="atlasbatchcall.axd" type="Microsoft.Web.Services.MultiRequestHandler" validate="false"/>
      <add verb="*" path="atlasglob.axd" type="Microsoft.Web.Globalization.GlobalizationHandler" validate="false"/>
          The IFrameHandler enables a limited form of cross-domain calls to 'Atlas' web services.
          This should only be enabled if you need this functionality and you're willing to expose
          the data publicly on the Internet.
          To use it, you will also need to add the attribute [WebOperation(true, ResponseFormatMode.Json, true)]
          on the methods that you want to be called cross-domain.
          This attribute is by default on any DataService's GetData method.
      <add verb="*" path="iframecall.axd" type="Microsoft.Web.Services.IFrameHandler" validate="false"/>
      <add verb="*" path="*.asbx" type="Microsoft.Web.Services.ScriptHandlerFactory" validate="false"/>
      <add name="ScriptModule" type="Microsoft.Web.Services.ScriptModule"/>
      <add name="BridgeModule" type="Microsoft.Web.Services.BridgeModule"/>
      <add name="WebResourceCompression" type="Microsoft.Web.Services.WebResourceCompressionModule"/>

Again watch out for duplicating a section. Be especially carefull around the compliation node. Chances are this will exist with a value indicating wether you want debug on or off. Just make sure you add the additional buildProviders.

Hey presto, you should now be able to add script managers and have some of that ATLAS goodness.

Author Mark Page

Mark is trying not to drink too much 'cool aid' at the moment. All the more for everyone else!

Add Comment


Your comment has been received and will be shown once it passes moderation.