65873 members! Sign up to stay informed.

Sponsored Links


Resources

.NET Research Library
Get .NET related white papers, case studies and webcasts

News News News Messages: 11 Messages: 11 Messages: 11 Printer friendly Printer friendly Printer friendly Post reply Post reply Post reply XML XML XML

New Article on Asynchronous Client Script Callbacks with ASP.NET

Posted by: Paul Ballard on August 11, 2005 DIGG
Paul Glavich has written an article that shows how ASP.NET based asynchronous client script callbacks work without the need for an AJAX moniker or add-on libraries. The article includes source code for creating client callback scripts with ASP.NET 2.0.
There has been a lot of interest in the web-facing community lately about a new useability feature that goes by a number of different names—XMLHTTP, AJAX, out-of-band requests, and asynchronous client script callbacks, to name a few.

Regardless of the name, this feature provides a way for a standard web page to make calls back to the server, without a traditional page refresh. The user is oblivious to the fact that a server call has occurred, and is not interrupted by it.
The article shows how to wire up two lists so that when a list item is selected, an asynchronous post goes to the server and the results update a field on the page. It then shows the ICallbackEventHandler interface and how to use it within a page.

The article also shows the client-side Javascript code necessary to invoke the callback request and to update the page controls with the returned value.
The string value returned from the RaiseCallbackEvent method on the server is passed in via the arg parameter, and the ctx parameter contains contextual information specified via the DoTheCallback method that initiated the asynchronous call—in this example ‘0’. DHTML is used to update the browser display with the text returned from the server.
Read Asynchronous Client Script Callbacks

Threaded replies

·  New Article on Asynchronous Client Script Callbacks with ASP.NET by Paul Ballard on Thu Aug 11 11:24:01 EDT 2005
  ·  that's all fine, but async HTTP is a hack by peter lin on Thu Aug 11 22:46:30 EDT 2005
    ·  It's all a hack! by Paul Ballard on Fri Aug 12 01:43:08 EDT 2005
      ·  I will be with you... by Mileta Cekovic on Fri Aug 12 06:02:41 EDT 2005
        ·  I will be with you... by Paul Ballard on Fri Aug 12 11:39:09 EDT 2005
      ·  It's all a hack! by peter lin on Fri Aug 12 09:53:47 EDT 2005
      ·  It's all a hack! by Mac Ferguson on Mon Aug 15 09:22:50 EDT 2005
    ·  that's all fine, but async HTTP is a hack by Kevin Lewis on Fri Aug 12 10:50:59 EDT 2005
      ·  that's all fine, but async HTTP is a hack by peter lin on Fri Aug 12 11:25:09 EDT 2005
        ·  that's all fine, but async HTTP is a hack by Kevin Lewis on Fri Aug 12 11:30:26 EDT 2005
          ·  right, but I wouldn't use webclient by peter lin on Fri Aug 12 11:40:11 EDT 2005
  ·  Smart clients ? AJAX ? HTML Form and postback ? by Fran?ois Lemaire on Fri Aug 12 02:51:52 EDT 2005
  Message #181095 Post reply Post reply Post reply Go to top Go to top Go to top

that's all fine, but async HTTP is a hack

Posted by: peter lin on August 11, 2005 in response to Message #181019
Let's call async http what it really is. An ugly hack on a request/response communication model to make it look like async calls. the end result is you hammer your server with tons of polling calls. I would think it's easier to just use MSMQ, Biztalk, or Indigo to really do messaging. Considering one can use the .NET hosting infrastructure to process the messages as HTTP, it should be easier and more scalable.

peter

  Message #181109 Post reply Post reply Post reply Go to top Go to top Go to top

It's all a hack!

Posted by: Paul Ballard on August 12, 2005 in response to Message #181095
Picking on Async HTTP as a hack is like pointing out that a rivet is loose on the Titanic. Most web development is a hack and ASP.NET is a HUGE hack. Fundamentally all web development is just request/response, the whole application of a forms based model on top of that with Postbacks, callbacks, etc. is a giant, complicated, and quite ingenius hack.

I say we just get rid of all of this and start developing smart clients! Who's with me? :-)

  Message #181112 Post reply Post reply Post reply Go to top Go to top Go to top

Smart clients ? AJAX ? HTML Form and postback ?

Posted by: Fran?ois Lemaire on August 12, 2005 in response to Message #181019
In my opinion, choosing between these options depends on the project. If you're making an e-commerce juggernaut or a public news site, you'll probably stick with simple postback. If you're making an intranet or extranet application, maybe you will use AJAX or switch to a smart client, but if you really need it. I've spent the last 5 years making web sites often to replace client/server application, and rarely have I felt that using such technologies would really enhance the experience, though I think it's great in some cases.

I guess AJAX or whatever you call it is hyped right now because web sites developers are bored with the actually very simple programming paradigm they use (request/response, request/response, and here we go once again, request/response...). They need some action ! Smart clients introduce a real difference, the ability (or simply the idea...) to work offline : using server resources "smartly". See you in 5 years :)

  Message #181132 Post reply Post reply Post reply Go to top Go to top Go to top

I will be with you...

Posted by: Mileta Cekovic on August 12, 2005 in response to Message #181109
I will be with you when decent framework (like .NET or Java) would exist on more then 50% client OS-es.
Now, it's below 10% sure, probably arround 5% (Java 1.4+ and .NET 1.1 together)

  Message #181170 Post reply Post reply Post reply Go to top Go to top Go to top

It's all a hack!

Posted by: peter lin on August 12, 2005 in response to Message #181109
Picking on Async HTTP as a hack is like pointing out that a rivet is loose on the Titanic. Most web development is a hack and ASP.NET is a HUGE hack.

Fundamentally all web development is just request/response, the whole application of a forms based model on top of that with Postbacks, callbacks, etc. is a giant, complicated, and quite ingenius hack.

I say we just get rid of all of this and start developing smart clients! Who's with me? :-)

You right. it's is all one big hack. Some parts more cool than others. I don't really consider ASP/PHP/JSP a hack. By now, it has gone through several revisions and refinements so that it isn't a hack. others might disagree, but I think it works great for cases where an user session is "mostly stateless" if we forget HTTP session for the moment.

my bias perspective is that HTTP is great for humans, but terrible for pub/sub and real-time applications. I've had people ask, "can you make an ASP application to monitor my servers in real time?"

Then again, doing this all in a RIA would be better to me. Even if google manages to make kick butt user interfaces using AJAX model, I still think the trade off in scalability is well beyond most people's experience and skills. Massive horizontal scalability is rather hard to achieve. A compromise between veritcal and horizontal scaling feels more manageable to me. I wish I knew how google handles all that hardware efficiently.

peter

  Message #181183 Post reply Post reply Post reply Go to top Go to top Go to top

that's all fine, but async HTTP is a hack

Posted by: Kevin Lewis on August 12, 2005 in response to Message #181095
I would think it's easier to just use MSMQ, Biztalk, or Indigo to really do messaging.
How do any of these replace the use of AJAX-like behavior? I can't imagine how one might use MSMQ to fill in a bit of a web page.

  Message #181186 Post reply Post reply Post reply Go to top Go to top Go to top

that's all fine, but async HTTP is a hack

Posted by: peter lin on August 12, 2005 in response to Message #181183
I would think it's easier to just use MSMQ, Biztalk, or Indigo to really do messaging.

How do any of these replace the use of AJAX-like behavior? I can't imagine how one might use MSMQ to fill in a bit of a web page.

Rather than use WebClient or the other call-back mechanisms, you'd write a messaging client to connect to a different server or same server with a different port number.

then it's just a matter of having your messaging client notify the browser using an event. this way, the browser isn't polling continuously to the webserver. it may require opening the firewall to allow for messaging, but at least this way the messaging server can lookup the subscription list for a particlar topic and publish the delta to the right subscribers. it's standard practice.

peter

  Message #181189 Post reply Post reply Post reply Go to top Go to top Go to top

that's all fine, but async HTTP is a hack

Posted by: Kevin Lewis on August 12, 2005 in response to Message #181186
Rather than use WebClient or the other call-back mechanisms ...
But we're talking about web clients, right? If you have to use a web client, what are you going to do? You're not going to get much help from MSMQ there, right?

  Message #181192 Post reply Post reply Post reply Go to top Go to top Go to top

I will be with you...

Posted by: Paul Ballard on August 12, 2005 in response to Message #181132
I think that number might be larger than what your say, but in any case it is increasing for .NET. Vista will have the .NET Framework installed by default.

I heard Billy Hollis give an excellent analogy to why installing the .NET Framework is no big deal. Most computers don't come with Adobe Acrobat Reader on them. But most people install it because it's useful and many things on the web are published with it. So, if the really cool sites require the .NET Framework, people will install it.

  Message #181193 Post reply Post reply Post reply Go to top Go to top Go to top

right, but I wouldn't use webclient

Posted by: peter lin on August 12, 2005 in response to Message #181189
Rather than use WebClient or the other call-back mechanisms ...

But we're talking about web clients, right? If you have to use a web client, what are you going to do? You're not going to get much help from MSMQ there, right?

in that case, you're stuck. If those in charge say, "you must use webclient" and the developers aren't allowed to write a messaging client using MSMQ, or Biztalk, there's nothing you can do. I've heard of plenty of cases where the company had a strict rule and no one was to violate those rules. Even if using a different approach would have provided a better and more scalable solution.

though, one could be sneaky and take the "do it and ask for foregiveness later" approach. software is there to serve the business needs, so it's not always possible to choose the most appropriate solution. It helps if Microsoft officially recommends doing it with messaging instead of AsyncHTTP.

That's my main compliant against AsyncHTTP. MS already has a better solution to solve the problem, but pushing AsyncHTTP promotes bad practices. Well, I consider it bad. I'm sure others will disagree.

peter

  Message #181336 Post reply Post reply Post reply Go to top Go to top Go to top

It's all a hack!

Posted by: Mac Ferguson on August 15, 2005 in response to Message #181109
.I say we just get rid of all of this and start developing smart clients! Who's with me? :-)

{crickets}.

 
New content on TheServerSide.NETNew content on TheServerSide.NETNew content on TheServerSide.NET

DSLs and language interop

Language "mashups" will become more prominent, and developers will become polyglots, one programmer suggests.

VS 2008 Resources

SearchWinDevelopment.com offers an introduction to the language, performance, testing and data management improvements in VS 2008.

VB code downloads home

VBCode.com code snippets cover all aspects of application development, from data binding to security to the user interface.

XAML Learning Guide

Get up to date on XAML best practices with a variety of articles, tutorials and webcasts. [SearchWinDevelopment.com]

Company uses VSTS DB edition to tame workflow

One team's experience with the VSTS DB edition suggests that it can improve workflow for dev teams. It also enhanced Agile efforts. (June 24, Article)

Book: Intro to DSL Tools

Microsoft has begun to include DSL tools in the VSTS kit. A new book by Steve Cook and other VSTS team members helps set the stage. (June 24, Article)

I See the Silverlight Shining!

Cartoon: Be it ever so humble there is no place like your home after you get a Microsoft Home Server . (June 18, Cartoon)

A look at .NET 3.5

Microsoft's Thom Robbins says new technology to highlight in NET 3.5 includes AJAX, LINQ for both C# and VB, as well as tooling enhancements intended to ease the task of building WPF, WF and WCF apps. (June 29, Podcast)

Venkat Subramaniam on AJAX

Venkat Subramaniam discusses AJAX bottlenecks, the tenets of Agile development and more. He spoke at the Ajax Experience. (June 25, Tech Talk)

Building a Claims-Based Security Model in WCF - Part 2

In the second of a two-part series, Michele Leroux Bustamente discusses design decisions related to the claims-based security model. Read the story and walk through the process for creating a set of claims-based utilities to encapsulate claims authorization at the service tier. (May 24, Article)

Introducing the Entity Framework

Understanding why the Entity Framework exists and learning where it can fit into your projects can get you prepared for the eventual release early next year. (May 10, Article)

WCF Security Learning Guide

Resource: This learning guide gives you quick access to useful links on Windows Communication Foundation security information. (April 24, Article)

Brad Abrams: Patterns for successful ASP.NET AJAX development

TSS.NET's Jack Vaughan spoke recently spoke with Microsoft's Brad Abrams to find out what he is seeing in the field and what the chefs in Redmond are cooking. Along the way he discusses patterns of AJAX frameworks. (April 11, Article)

Building a Claims-Based Security Model in WCF

In a two-part series, Michele Leroux Bustamente explains how claims-based security is supported by WCF, and how you can implement a claims-based security model for your services. (March 29, Article)

Authoring workflow using XAML

Windows Workflow Foundation is a new technology that many developers will need to get their heads around. In a brief excerpt adapted from Programming Windows Workflow Foundation: Practical WF Techniques and Examples using XAML and C#, K.Scott Allen considers aspects of workflow definition. (March 22, Chapter Excerpt)

News | Blogs | Discussions | Tech talks | Patterns | Reviews | White Papers | Downloads | Articles | Media kit | About
All Content Copyright ©2007 TheServerSide Privacy Policy
Site Map