Real World AJAX with ASP.NET Session

I have to give credit to Nikhil Kothari. He just ran a session the way that I like to see sessions run. As I read the title and abstract for the session, I was expecting not much in the way of new information. I actually attended the session mostly because it was the only one in this time slot that might be of interest.

Nikhil started out with just some basic stuff on AJAX. But very quickly he got past that and the session became very interesting. The idea is that if you plan on using AJAX in a "real" application, there are a number of issues that need to be address. Simple issues to identify, but complex to deal with. For example:

History

Say you have a page that makes a number of AJAX calls, updating the screen each time. Then you click on the back button. The typical action is to go to the page prior to the initial view of the current page. But what you generally what to do is go to the results from the previous AJAX call.

The solution is to use an AJAX UpdateHistory control. More details can be found on Nikhil's weblog here. It requires some work by the developer to determine when the browser history needs to be updated, but if you put the effort in, your users will love you. OK, not really. This is one of those features that users will ignore if it's there, because your site is working as they think it should. But if you don't have it, they will hate you. It's almost the same thing.

Indexability

If you have a page that uses AJAX to retrieve and display information, you have a problem with making that page appear in the appropriate place within Google. After all, Google depends on static data for its indexing.

The pattern that Nikhil is suggesting is to create a static page that contains all of the data. Make the data static on page. Put the data into a hidden div. Then create a separate frame and use script to pull the data from the hidden div into the frame. When viewed normally, the data will appear in the frame. When crawled by a spider, the script is not executed, so the data is just available for indexing. This pattern might not work in all situations, but there are enough to make it worthwhile being aware of. Again, a blog post (here) provides some additional details.

Overall, a nice presentation with some useful takeaways.

Silverlight 2 - Fundamentals

I'm sitting through the first part of the Building RIA using Silverlight 2 session. The starting point is some of the new, but quite fundamental elements of Silverlight 2

First off, the schedule of releases at the moment are:

Beta 1 = today, with a non-commercial go-live license

Beta 2 = Q208, including a commercial go-live license

Silverlight 2 now includes a TextBox (only about a year too late).

Silverlight works in a sandbox. It has access to local storage through isolated storage. But basically consider Silverlight applications to have the same level of local storage as your current web browser.

Silverlight supports cross-domain requests, but the target domain needs to be configured (via a policy file) to accept requests from Silverlight.

Silverlight has a number of classes available to allow a number of easy mechanisms to make a request to the current or a different domain. And those requests can be made both synchronously and asynchronously.

A large number of intrinsic controls are now available. And the controls are very skinable.

There is support to one- or two-way data binding. The binding mechanism seems to be quite similar to ASP.NET, although the syntax is a little different.

Scott Guthrie Keynote - 3

Silverlight 2 beta includes

  • Multi-language support - VB, C#, Iron Ruby, Iron Python
  • WPF UI, including data binding
  • Networking stack - REST, SOAP, WS-*, sockets. And cross-domain stuff is supported
  • Integrated Data Support - LINQ, and the ability to cache data across browser sessions
  • High performance
  • Small download, fast install - 4.3 MB download, no .NET Framework download required, working with Novell on a Linux implementation

Includes a lot of built-in controls

  • Sliders
  • Calendars
  • DatePicker
  • DataGrid

Built-in controls are shipped with source included in the beta. Open license allows for modification and resale.

The built-in controls are now completely skinable, including custom animations.

Also including unit testing capability for Silverlight controls. Around 1200 unit tests included for the built-in controls.

They are also shipping preview versions of Silverlight tools for VS2008 and Expression.

Scott Guthrie Keynote - 2 - Silverlight and the Olympics

Silverlight is a major part of the Olympics 2008 Site

2200 hours of live streaming coverage over 22 days. This, plus the 1100 hours of content on the 5 NBC broadcast networds, will be made available as Video On Demand.

Also, through Silverlight, you will be able to see live streamed coverage of all 34 sports. As part of the live coverage, you can

  • rewind and rewatch the stream
  • view pop-up alerts of other activities in other sports.
  • share link to the live coverage with others.
  • include picture in picture (PiP) of multiple sports
  • view multiple live streams of the same sports, even PiP

Very cool, especially if you're a fan of non-traditional sports. But I wonder if such a service will be available outside of the US.

Scott Guthrie Keynote - 1

Silverlight 2 Beta 1 is available for download after the keynote

Changes include enhancements for media. Sorry, but this section includes terms that don't mean that much to me. High Def? I thought he was a rapper. ;) But let me make some notes

Adaptive Streaming - The Silverlight client can adaptively determine the bandwidth between the client and the server and set the bit-rate appropriately. And can change on-the-fly, if necessary

Total Cost of Ownership - Windows Media Services 2008 is free. Provides 3x the scalability of other services, yet maintains a high level of reliability. Also, there is support for progressive downloading, including bit-rate throttling. Progressive downloading means that the initial 10s or so of content is bursted out, but beyond that it just maintains the 10s buffer instead of trying to get as much content as you can to the client as quickly as you can.

Business Opportunities - Integration of advertising into the Silverlight experience. Jon Harris demos a Silverlight Advertising Template. Template is a Visual Studio 2008 project template and the wizard used to create it. The result is a project that includes a fair bit of commonly used Silverlight functionality

Dean Hachamovitch Keynote - 1

Dean is responsible for IE 8. And he is talking about 8 points (because developers can count higher than 3). If you've given presentations, you'll understand that reference.

1. CSS 2.1

There are issues with CSS support in IE7. IE8 addresses these by focusing on full support for CSS 2.1 standard.

2. CSS Certification

Getting certified is the best way to ensure that all browsers will render standard CSS correctly. Microsoft has provided a large number of test cases to include in the certification process. The problem will be backwards compatibility. There are instances where pages look gook in IE7, but don't look good in Firefox. Because IE8 is more CSS compliant, it also looks bad in IE8. There is, however, an IE7 compatibility more (under control of the page developer) to force IE8 to work like IE7

3. Performance

They have improved JS script performance by a factor of approx 2.5 times. Not always as good as Firefox/Mozilla, but a great improvement over IE7. And they are still working on it.

4. HTML 5 Support

The back button doesn't work well with AJAX functionality. Sometimes 'Back' doesn't get you what you expect. Support for HTML 5 means (among other things) an interaction that is more like what the use expects

Also, HTML 5 support includes network awareness. A connection gets lost and the page responds, including the ability to modify the content of the page.

5. Developer Tools

IE8 includes built-in developer tools. Includes a script debugging window, complete with breakpoints, watches, an immediate window, etc.

Also includes the CSS debugging info similar to what is found in Visual Studio 2008. When you select a particular element in the document, you can see the styles which are applied to the element. This allows 'wrong' style values to be quickly identified with regards to their source.

6. Activities

Activities are context-sensitive bits on a web page. Select text and quickly get to a map of the address it represents. Or find the selected item on Ebay. "Quickly' invokes a right click or selecting from an Activities menu that is similar in location to the Exception Helper in Visual Studio.The context for the selection is provided through an architecture known as OpenService format. It is called the OpenService Specification and Microsoft has made it available for comment.

7. WebSlices

The Web Slice is a part of a web page that contains basically a summary (a slice) of another web page. Provides quick, pop-up summary of a separate web page. A summary of a Facebook friend can be  retrieved through either a context-sensitive click or a toolbar click. And the current page is not left.

The is a WebSlices spec that contains the details.

8. IE 8 Beta 1 is now available. Or at least, after the keynote.

Ray Ozzie Keynote - 2

The idea behind the concept of connected devices is to create software to provide a personal device mesh using the Internet as a hub. By having a central personal data store, complete with synchronization, the devices will become much more a part of 'you'. A current research team has been working on this starting with the PCs.

A second scenario is connected entertainment devices. The vision includes having DRM be transferable between your own devices. Purchase music and be able to listen to it on your computer, your Zune and your XBox without requiring additional licenses.

Office Live Workspace, opened up to a broad public beta as of yesterday, has a major role in the connectivity picture. You will be able to tag Office documents and make them available to people who are interested in what you have to offer.

You will be able to run Exchange, Sharepoint and Office Communications Server in either the typical, on-premise server or as a hosted service (called Exchange Services, Sharepoint Services, and, well, you get the idea).

He also touched on SQL Server Data Services as a developer database in the cloud. I'll have to check that out.

And  now, on to Scott Guthrie.

Ray Ozzie's Keynote - 1

If you want to know why Microsoft made the play for Yahoo, look no further than one of the three main focuses that Ray Ozzie sees for the near future. He expects on-line ad revenues to double to $80B annually over the next two years. And to not make such a play is to basically concede the bulk of the market to Google (my opinion, not his)

The second prong in Microsoft's strategy is based on the idea that the Internet has become a hub of a large number of devices. The list goes from PC to gaming systems to cell phones to cars. The idea of the Web is to bring together a collection of personal devices. And one of the guiding principles of Microsoft's software offerings is to provide a mechanism to facilitate this future.

The business side of the "Internet is a hub" is being brought out in virtualization. Current software will be "refactored" to support virtualization in many different ways.

"Small pieces loosely joined" (a Weinberg quote, I believe) is the new motto.

More to come...

Looking for Clues

So one of the question about MIX is whether there will be a 'surprise' announcement. Last year, it was the Windows Live Streamer that allowed people to store video in the cloud and have it served to your site.

I don't think the availability of Silverlight 2 qualifies. There are many sessions that have a Silverlight 2 label and in the hands-on lab section, I was told that the Silverlight 2 labs that are in the list won't be available until after the keynote. So not much of a surprise there.

However, there is a block of hands-on lab computers that were not active yesterday. And there is a rumour of a session titled "X talking about Y" that will be dropped into one of the open session blocks. Both of these suggest that some announcement in the tool realm will be dropped sometime in the next couple of hours. Stay tuned.

Off to MIX

First off, let me comment on the dearth of posts for the last few months. As always, it has to do with my workload. I have been working heads down on a major project for client for about six months. On top of that, my evenings are spent co-authoring the Training Kit for the WCF exam. The result is that I don't have a lot of time left for extra-curricular writing, which is what this blog is. I expect both of those to change shortly, so there should be more posts in the coming months.

The client project is actually one of the slickest that I've worked on. It uses a ton of cutting edge technologies, including WCF, the component application block (CAB) and even WPF. It's that last piece that's the most interesting because it's the first time that I've seen WPF used in a line of business application in the wild. My colleague, Rob Burke, is the author of this coolness. He demoed it at our At the Movies presentation and has blogged about it here. Take a look if you get the chance. It's well worth seeing.

But all of this is beside the point of this post. At the moment, I'm on a place heading to Las Vegas for the MIX '08 conference. I'm expecting a ton of blogging activity this trip, so get ready for a flurry of posts over the next week as I try to keep up with what's happening.