ASP.NET
  Home arrow ASP.NET arrow Page 4 - Three Patterns of Constructing an ASP.NET ...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

Three Patterns of Constructing an ASP.NET AJAX-based Applications
By: Xianzhong Zhu
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2007-07-17

    Table of Contents:
  • Three Patterns of Constructing an ASP.NET AJAX-based Applications
  • Choosing the Pattern Most Suitable for You
  • Function and Architecture Overview
  • Enable ASP.NET AJAX Support for JSSK

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Three Patterns of Constructing an ASP.NET AJAX-based Applications - Enable ASP.NET AJAX Support for JSSK


    (Page 4 of 4 )

    With a general overview of the JSSK's basic function and architecture, we're now ready to supply ASP.NET AJAX support for JSSK. In the following sections, we will apply appropriate controls supplied by ASP.NET AJAX and ASP.NET AJAX Control Toolkit to achieve this goal. First of all, let's enable ASP.NET AJAX Support for JSSK.

    Adding the Necessary ASP.NET AJAX Assemblies

    This step is pretty easy; you just need to copy the assemblies named Microsoft.Web.Preview.dll and AjaxControlToolkit.dll to the bin folder under the root of the JSSK project. Note here we have not explicitly added the core assembly named Microsoft.Web.Extensions.dll since it was added into the .NET GAC automatically when the MS AJAX framework was initially installed.

    Modifying File Web.config

    In my opinion, this is the most important and a MUST-HAVE step in ajaxifying the JSSK project. Here we only talk about the associated parts of the sample in this article while omitting the complete configuration for the web.config file in constructing a complex ASP.NET AJAX-based web application.

    First of all, to let the HTTP Handler supplied by MS AJAX handle the requests to Web Services and JavaScript resources, you have to add the following configuration code under the <system.web> sub-section of the <configuration> section.

    <httpHandlers>

       <remove verb="*" path="*.asmx"/>

       <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

       <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

       <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>

       <add verb="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>

     

    Second, under the <pages> sub-section of the <system.web> section you'd better add the following tag prefixes to register the controls that come from ASP.NET AJAX and ASP.NET AJAX Control Toolkit, a uniform and meaningful prefix.

    <controls>

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

       <add tagPrefix="asp" namespace="Microsoft.Web.Preview.UI" assembly="Microsoft.Web.Preview"/>

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

       <add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="ajaxToolkit"/>

    </controls>

     

    Third, still under the <system.web> section, you must add the following code to create the necessary HTTP Module.

     

    <httpModules>

       <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

    </httpModules>

     

    Finally, to show the complete exception information during debugging, you'd better set the Mode parameter to Off, which is finished under the <customErrors> sub-section of the <system.web> section.

     

    <customErrors mode="Off" defaultRedirect="customerrorpage.aspx"></customErrors>

     

    A big step to ajaxifying your legacy ASP.NET 2.0 applications has been finished! You can refer to the downloaded source code for detailed info. Let's go on with the more detailed aspects.

    Adding the Server Control-ScriptManager

    The ScriptManager server-side control serves at the headquarters of each ASP.NET AJAX-based application, which mainly takes the responsibilities of sending the necessary JavaScript files and Web Service proxy in the run time to the client-side browser. Note that since nearly every web page in JSSK needs be enhanced using ASP.NET AJAX, it is suggested that you add the ScriptManager control into the MasterPage.master master page, where you get it done once and forever. There's still one point to note: you have to add this control before all the other ASP.NET AJAX controls, so you can place it next to the <form> section as shown below:

     

    <form id="form1" runat="server" visible="true">

    <asp:ScriptManager ID="sm" EnablePartialRendering="true" runat="server" />

    Please check back tomorrow for the second part of this three-part article.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

    ASP.NET ARTICLES

    - Source Code for Saving and Retrieving Data w...
    - Using GridView to Save and Retrieve Data wit...
    - Handling Dynamic Images in ASP.NET 3.5 AJAX ...
    - Retrieving Data with AJAX and the GridView C...
    - Playing with Images in ASP.NET 3.5 AJAX Appl...
    - Saving and Retrieving Data with AJAX
    - Enhancing PHP Via the ASP.NET AJAX Framework...
    - Enhancing PHP Programming with the ASP.NET A...
    - Classes and ASP.NET AJAX
    - Using ASP.NET AJAX
    - Building a Simple Storefront with LINQ
    - Developing a Dice Game Using ASP.NET Futures...
    - Completing an ASP.NET AJAX Server-Centric Ba...
    - Information Management for an ASP.NET AJAX S...
    - Comment and Order Management for an ASP.NET ...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT