Tech Blog

Jay's Technical blog

How To: Enable Microsoft ASP.NET Ajax Extension V1.0 (and Jan. 2007 CTP) on an existing site

26 January 2007
Jay Kimble

[WARNING! This is an archived post and as such there may be things broken/missing here.. you have been warned.]

[Small update: I corrected the complete system.webServer section in the CTP.  I forgot to apply one of the changes from RC1 to V1.0.] 

[Here’s the latest update to my series of articles on enabling MS Ajax V1.0 and the CTP in an existing site. I decided to write up a completed article… I haven’t decided how I will handle.  I have also noted the differences between RC1 and v1.0.]

Enabling Microsoft ASP.NET Ajax Extensions
As with the last time we need to make some edits to the Web.Config file.

Step 1
If you don’t already have a configSections section then add one right after the <configuration> tag; the top of your file should look like thisif you needed to add the configSections element:

<?xmlversion="1.0"?>
<configuration>
   <
configSections>
   </configSections>

Now right before the</configSections> tag add the following:

<sectionGroupname="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
  
<sectionGroupname="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
         <
sectionname="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false"/>
      <
sectionGroupname="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
         <
sectionname="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" />
         <
sectionname="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" />
         <
sectionname="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" />
      </
sectionGroup>
   </
sectionGroup>
</sectionGroup>
[There are no changes between V1.0 and RC1 in this section]

Step 2
Add the following lines inside the system.web section (this lets you use MS ASP.NET Ajax tags in pages without referencing the assembly in the page… I have given you the complete pages section, pay attention some third party tools also use this section… I would suggest adding this code and then re-adding the items from the third party tool back to the appropriate places):

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

[The big changes between this one and RC1 is that the tagMapping section has been removed]

Step 3
In the assemblies section of the the compilation section within the system.web section (you may need to create close tags for compilation element as it usually doesn’t have any child tags).  Add the following lines (I’m giving you the complete compilation section… look closely at what you are overwriting… if you have child tags of compilation you may need to add them back in... Also if you are using something other than C# then remove the defaultLanguage="C#" from the compilation tag):

<compilationdebug="false">
  
<
assemblies>
      <
addassembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
   </
assemblies>
</compilation>
[There are no changes between V1.0 and RC1 in this section]

Step 4
Also in the system.web section, you also need to add some handlers to the httpHandlers section (I’ve shown you the complete httpHandlers section in case you don’t have one — you may only need the additional stuff between the httpHandlers tags.nodes):

<httpHandlers>
  
<removeverb="*" path="*.asmx"/>
   <
addverb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
   <addverb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
   <addverb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</
httpHandlers>

[There is only 1 change between RC1 and v1.0 which is that an additional add for the *._AppService.axd.]

Step 5
Also in the system.web section, you also need to add some modules to the httpModules section (I’ve shown you the complete httpModules section just like I did with the httpHandlers):

<httpModules>
   <
addname="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</
httpModules>
[There are no changes between V1.0 and RC1 in this section]

Step 6
Finally after the</system.web> element and before the last </configuration> element, add the following ASP.NET AJAX (only) code:

<system.web.extensions>
   <
scripting>
      <
webServices>
         <!--
Uncomment this line to customize maxJsonLength and add a custom converter-->
         <!--
        
<jsonSerialization maxJsonLength="500">
            <converters>
               <add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>
            </converters>
         </jsonSerialization>
         -->
        
<!--Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate.-->
         <!--
        
<authenticationService enabled="true" requireSSL = "true|false"/>
         -->
        
<!--Uncomment these lines to enable the profile service. To allow profile properties to be retrieved 
                and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and
                 writeAccessProperties attributes.
-->
         <!--
        
<profileService enabled="true"
                                 readAccessProperties="propertyname1,propertyname2"
                                 writeAccessProperties="propertyname1,propertyname2" />
         -->
     
</webServices>
      <!--
 
      <scriptResourceHandler enableCompression="true" enableCaching="true" />
      -->
  
</scripting>
</
system.web.extensions>

<system.webServer>
   <
validationvalidateIntegratedModeConfiguration="false"/>
   <
modules>
      <
addname="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
   </
modules>
   <
handlers>
      <
removename="WebServiceHandlerFactory-Integrated"/>
      <
addname="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
              type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      <addname="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
              type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      <
addname="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
   </
handlers>
</
system.webServer>

[There’s only a couple differences v1.0 and RC1.  All the changes are in the system.webServer’s handlers section. The name attribute has changed from “WebServiceHandlerFactory-ISAPI-2.0” in “WebServiceHandlerFactory-Integrated” in the remove element.  A new add element is added for the ScriptHandlerFactoryAppServices.  The final add element has a new preCondition attribute and a the verb has changed from just “GET” to “GET,HEAD.”]

Just like with RC1, the Microsoft.Web.Extensions.dll is installed in the GAC, so you won’t need to reference any DLLs and you are all set to use the ASP.NET Ajax Extensions…

[begin Shameless Blogger plug]
Jay Kimble, Independent Consultant
Your Ajax Expert

[end Shameless Blogger plug]

One of the first things you will notice is if you used Atlas at all is that there are a number of missing components.  Where did they all go? Simple, there was too much work to get it all done soon, so they split Atlas into 2 projects.  One that delivers the most popular components (the ScriptManager and the UpdatePanel, mainly), and one that delivers everything else.  So how do we enable the rest of the components.

Enabling Microsoft ASP.NET Ajax CTP (future technology) on an existing site
The first step is to go through all the steps in enabling the ASP.NET Ajax Extensions.

Now in the controls section withinthe pages section inthe system.web section (see step 2 above) add the following lines:

<addtagPrefix="asp" namespace="Microsoft.Web.Preview.UI" assembly="Microsoft.Web.Preview"/>
<
addtagPrefix="asp" namespace="Microsoft.Web.Preview.UI.Controls" assembly="Microsoft.Web.Preview"/>

[There are no changes in these nodes with RC1.]

The complete pages section will look like this (if you didn’t need to customize it as a result of some other tool/library):

<pages>
   <
controls>
      <
addtagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      <
addtagPrefix="asp" namespace="Microsoft.Web.Preview.UI" assembly="Microsoft.Web.Preview"/>
      <
addtagPrefix="asp" namespace="Microsoft.Web.Preview.UI.Controls" assembly="Microsoft.Web.Preview"/>
   </
controls>
</pages>

Add the following code to the compilation section underneath the system.web section (after the “</assemblies>” but before the “</compilation>”):

<buildProviders>
  
<addextension="*.asbx" type="Microsoft.Web.Preview.Services.BridgeBuildProvider"/>
</
buildProviders>

[There are no changes in these nodes with RC1.]

The complete compilation section looks like this:

<compilationdebug="false">
   <
assemblies>
      <
addassembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
   </
assemblies>
   <
buildProviders>
      <
addextension="*.asbx" type="Microsoft.Web.Preview.Services.BridgeBuildProvider"/>
   </
buildProviders>
</
compilation>

Add the following http handler to the httpHandlers section:
<addverb="GET,HEAD,POST" path="*.asbx" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>

[There are no changes in these nodes with RC1.]

The complete httpHandlers section looks like this:

<
httpHandlers>
   <
removeverb="*" path="*.asmx"/>
   <
addverb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
   <addverb="*"path="*_AppService.axd"type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"validate="false"/>
   <
addverb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
   <
addverb="GET,HEAD,POST" path="*.asbx" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</
httpHandlers>

Finally, add the following httpHandlers handler to the section in the system.webServer section:

<addname="ASBXHandler" verb="GET,HEAD,POST" path="*.asbx" preCondition="integratedMode"
         type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

[There are no changes in these nodes with RC1.]

The complete the system.webServer section looks like this: 

<system.webServer>
   <
validationvalidateIntegratedModeConfiguration="false"/>
   <
modules>
      <
addname="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
   </
modules>
   <
handlers>
      <
removename="WebServiceHandlerFactory-Integrated"/>
      <
addname="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
              type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      <addname="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
              type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      <
addname="ScriptResource" verb="GET" path="ScriptResource.axd" 
              
type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      <
addname="ASBXHandler" verb="GET,HEAD,POST" path="*.asbx" preCondition="integratedMode"
              type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
   </
handlers>
</
system.webServer>


The final step here is to add a reference to the Microsoft.Web.Preview.dll assembly. 

[tags:MS Ajax Extensions, ASP.NET, AJAX]


MS Ajax Extensions V1 released...

24 January 2007
Jay Kimble

[WARNING! This is an archived post and as such there may be things broken/missing here.. you have been warned.]

In case you missed this yesterday (and I did). The Microsoft Ajax Extensions V1.0 are now released. There’s also a January CTP for the rest of the stuff that used to be “Atlas.” You can get them over here. I’ll be updating the converting an existing site to use MS Ajax post of mine very soon (as well as will be experimenting with the library and posting on it again as well as a couple other Ajax tools I’ve been playing with).

[tags: ASP.NET.AJAX, MS AJAX Extensions]


Tagged

11 January 2007
Jay Kimble

[WARNING! This is an archived post and as such there may be things broken/missing here.. you have been warned.]

Peter tagged me a few days ago, and I haven’t had a chance to respond. So here goes…

5 things you don’t know about me (do you really want to know this?)

  • I not only write code, but music although I’m not coordinated enough to really play an instrument although I think I have a decent singing voice (I write by plunking out the melody on my keyboard and from there can determine proper chords for a real musician).  BTW, I sand my first solo in front of a crowd at 5 (it was pretty bad).
  • I was the lead singer of a local college band back in the early 90s.  Dave Balzer —of DevAuthority fame— was the Keyboard —and sometimes Bass— player of the band.  Dave at the time was my primary song writing partner.
  • Like many Gen-Xers, I managed to cram 4 years of college into 5.5 years.
  • I was born in 1968 and am 38 years old (not 40 yet… thank God!). [Ok, that might not be a good one… How about this?]  I am a steak and potatoes kind of guy, although not-too-spicy Mexican food and Japanese Hibachi are also favorites.
  • I have yet to figure out what I want to do when I grow up.

So now it’s my turn to tag…

Let’s see how about

 


Available...

09 January 2007
Jay Kimble

[WARNING! This is an archived post and as such there may be things broken/missing here.. you have been warned.]

After spending the last year as a contractor for ASPSOFT (working mostly from home), I am on my own.  ASPSOFT ran into a shortage of work which for small consulting firm makes things tough. 

So where do I go from here?  I’m really not sure honestly.  Obviously, if work picks up for ASPSOFT then I might be able to go back there, but I’m not going to sit around waiting.  I really like working from home.  I like the flexibility.  It also helps that my home is perfect for doing this.  I have an office in a separate section of my house. 

Prior to ASPSOFT, I worked for TechData (the often “nameless” company) which is a fairly large corporation.  I hated it!  I’m not meant for major amounts of company politics. 

At the moment one could call me a “freelance author” since I am writing a couple white papers for a company that sells developer tools (that’s all the more I will say).  There may be more of this type of work in the future, but right now we’ll see; it pays OK, but not really enough to for a full-time job.  It works for the moment. 

I also have a little bit of contracting lined up, but I know that won’t last forever (one of which is some Ajax stuff).  I need to consider a few other options… I’m thinking about trying to work out a deal with some contracting firms to handle subcontract some of their extra work.

[tags: needajob]