benjaminm's blog
big thoughts in the software world

ASP.NET Whidbey Presentation - Scott Guthrie
Thames Valley Park, February 9 2004

 

When's ASP.NET Going to be available?

The aim is to ship a Beta in June and for RTM in Q1 2005.   There will be a 'go live license' that will let people put Beta 2 into production, later this year.  The Beta in June will be a public beta and it will be possible to download ASP.NET and Visual Studio Whidbey.

 

The build that Scott demonstrated with was from last Monday when he said they achieved 'Code Complete.  So they are now in that long stabilisation phase.

 

Key Message

ASP.NET Whidbey allows you to create cooler apps in a fraction of the time it takes today.

ASP.NET Raises the bar of what is expected as a minimum website functionality.

 

ASP.NET Whidbey Themes

  • Developer productivity
    • Reduce the number of concepts that developers have to learn and understand
    • Reduce the lines of and lines of code - 2/3 fewer lines of code in a solution
    • Create an awesome Visual Studio .NET tool experience
    • Enable rich web scenarios not possible today
  • Administration and Management
    • The aim is to create the easiest platform to manage and administer.  ASP.NET V1 was a good platform in terms of XML files for configuration and XCOPY deployment.  ASP.NET Whidbey extends this with an API for scripting.  The IIS management console has a new tab that provide a GUI interface for every setting in web.config.  There is also good support for health monitoring and automatic notification for problems.
  • Extensibility
    • Developers should be able to replace or extend all of the built-in features of ASP.NET. There is a Provider model that abstracts the implementations from the service - so it is easy to write a custom provider or use different providers.
    • Enable enterprise environment customization.  Move past demos that show how clever the product is to in the demos, but fall over when used in an enterprise scenarios.  ASP.NET Whidbey has an application stack where each level can be replaced, customized and extended.
  • Performance and scalability
    • The goal was 'how do we make it easier to build apps faster?'
    • ASP.NET Whidbey works on 64-bit processors without having to rewrite anything.  This means you use more memory addresses (I hope this works by default because I guess that no one in the room was really from a deep C++ background).  Any existing 1.1 app and it will be 64-bit enabled (no recompile or code-changes).
    • Database cache invalidation.  ASP.NET Whidbey allows for caching dependent on databases.

 

The ASP.NET Build block architecture

  • Membership - Create and delete users, login, registration and password reminder controls.
  • Role Manager - map users to roles, provide permissions by roles.  Automatically saves role to a role management store (access database, sql server, active directory, oracle later).  Saves having to write custom database code.
  • Profile - strong typed access to a Profile object.  Can define custom properties.
  • Site Navigation - what is the relationship between nodes in the site.  An API to say what link am I on - what are my parent, siblings and children.
  • Database cache - Dependency notification from DB
  • Management - Configure in web.config and machine.config through code APIs.  This works for local and remote servers
    • Health monitoring, risk diagnostic for tracing.  Unified tracing through the platform (asp.net forms).  One component, unified acces.
    • Management API - IIS Admin took has the config settings - don't have to touch the XML file.  Everything through an Admin form.

 

Building Blocks don't rely on web forms or winforms - they aren't UI specific

 

Provider Model design pattern

  • All the blocks have interfaces, such as IMembershipProviders or IRoleProvider.  You can subclass existing providers - source code will be provided for the providers to demonstrate how developers can tweak them. 
  • You can build your own, register with machine.congif or web.config.  For example you can create your own storage locations or plug in any of the building blocks into other implementations (e.g. store membership information in an LDAP store).
  • There are even providers for SessionState and the FileSystem so you can pull data from a database, from a SAN
  • All of the built-in providers work with SQL Server out of the box.  Some things are easier in custom SQL store rather than an Active Directory. Windows, SQL Server, Access MDB file are also supported.   An Oracle provider project currently underway.
  • When you deploy you can choose providers from drop-downs, or configure new providers.  Completely abstracted from the user code.

 

Framework Layer

  • Master pages - These provide a way of defining a custom layout for a page.  You can mark some areas as overridable in pages created based on the mater page.  When edited in Visual Studio these areas are enabled, all of the other areas are greyed-out.
  • Theme/Skin - Provides a way of applying a consistent look and feel to all of the ASP.NET controls, similar to the role that CSS files play for static HTML content.
  • Localization - Builtin page framework support that works similar to windows forms, based on external resource files.
  • Adaptive UI - the idea to enable the model to build for website and other devices, such as cell phones.  In previous version - mobile controls - still there - but it was a separate set of control.  Now the same control can work for web and device - part of page framework -  Developer only needs one set of APIs and controls.  In future - upsize to Longhorn controls.

 

Server Controls

  • ASP.NET ships with over 50 new controls!
  • They leverage the page framework or building blocks for their logic.
  • 'Control Buckets' - scenarios:
    • Security - asp login or asp create user or asp password recovery.
    • Data - 2 and 3-tier fashions.  Middle-tier data binding - yes, not just two-tier.
    • Navigation - menu, tree view, bread crumb.  On top of the site navigation.
    • Web Parts - rich page-personalization for end user - customize look and feel and layout.

 

ASP.NET application hosting

  • ASP.NET app-model extended to support non-HTTP
    • Key Scenario: Indigo service
  • Unified app model for web/service app
    • Membership and role mgt
    • State mgt
    • Caching
    • Config and mgt
    • Process activation, reliability and recycling
    • Health monitoring
  • Great host for Building/Runin indigo service
    • Reliable queuing, transactions, improved security
    • Web services with indigo inside ASP.NET

 

Web development in Visual Studio

  • Web Development in Visual Studio
  • FrontPage server extensions no longer required!
    • Support file system, IIS, FTP and FrontPage Server Extensions for web sites.
  • Directory based project system model - Edit any web  anywhere (no proj file required)
    • No project files!
    • If you have a single app - you don't need a project file - point at a directory and you're away with full IntelliSense
    • For multiple dev team no competition for a single *.proj file
  • Dramatic performance improvements with larger web sites
    • Recompile a single page rather than the whole site.
  • No longer required to build entire site into a Single DLL
  • Can now re-build just individual pages to test and run
    • Just deploy a single file.
  • HTML source preservation
    • Tool will never re-format or mangle your code
  • Flexible HTML Source Formatting Options
    • Precisely control format of designer generated HTML
    • Optionally re-format HTML to match your format.
      • Apply to highlighted region
      • Save rules as XML file - share with team.
      • New markup will comply with these rules
  • IntelliSense everywhere
    • Code behind, inline code, HTML, CSS, ASP.NET, web.config, xml files etc
  • Html tag navigator and tag outlining
    • Easy to view, navigate and explore complex pages
  • XHTML support w/Pluggable Validation Engine
    • Real-time validation IntelliSense as you type HTML
    • Validation driven IntelliSense for client-side script
      • Target specific DOM - IE6 and Navigation.
      • Red squiggly for compliance error notification
      • Runs of a schema - makes building compliant sites much easer
  • Accessibility compliance
    • Section 508 or WCAG compliance checker
    • Source compliance checker for html/ASP.NET controls
      • e.g. check img tags for alt text.
  • Richer HTML Designer Enhancement
    • Enhanced table editing and creating
    • Clean CSS Style Generation for XHTML Compliance
  • Rich Master Page Design-Time Support
    • Full WYSIWYG Editing Support
      • All master pages greyed out, only make changes to allowed section
  • Enhanced ASP.NET code-behind page editing
    • Cleaner and more OO code editing support
    • Removes  brittleness of current tool wire-up.
      • Gets rid of initialize method - remove the 'do not touch section.  The only code in the file is code that you write.
  • ASP.NET single file page editing support
  • Full IntelliSense and debugging support
  • Built-in ASP.NET web server (no IIS required)
    • only local browser requests, no security worries
  • Shuts down when Visual Studio is closed.
    • Similar to Cassini web server that first shipped with Web Matrix
    • Allows asp to run as usual user on the box.  No special user rights are required!
  • Publish Web - synchronize from local to remote - similar to FrontPage 2003
    • Full log file to allow to see who made the update.
  • Testing tools - app centre test has per test, but extending for support automating post-back and functional automation of asp.net features.  Build test cases and frameworks.
  • Rich Data design-time support
    • -> data access layer build - model tables and methods - create strongly-typed business components.  Utilize this with code-refactoring and generics.  Ship in all versions of the tool.  Common across all project types.  Creates the XSD in a designer. Scott - 'I've never met two people who like the same data view builder'

 

Major advances coming in Whidbey

  • Will be 100% compatible with ASP.NET 1.0 and ASP.NET 1.1
  • Run on IIS 5.0, IIS 5.1, IIS 6.0 - it requires no OS upgrade.
  • Will run side by side with previous versions

 

Building and running web apps will be easier than ever before

  • Develop web apps in a fraction of the time
  • Developers can focus on adding even more value-add (person, dynamic UI etc) to their apps

 

 

Demonstration notes

 

Creating a new web project in a file system directory with no solutions file!

  • Much richer project system - no project file on disk or FrontPage Server Extensions
  • Choose Location comes with Local IIS along with FTP and Remote Sites.
    • To find the virtual directories on the local webserver it queries the IIS metabase directly.
    • The Create Project dialogue makes it easy to create, edit or delete virtual directories without needing to go to the IIS manager
  • Ftp will be the remote deployment approach of the future.
  • The aim is to ship ASP.NET Whidbey with 10 - 15 app templates projects covering projects such as Portal, Line Of Business, Reporting, Community and other projects.  These will include support for site navigation, master page and data structures.
  • When the new site was created there was nothing in the file system directory - no web.config or CSS.  There's also no solution file (*.sln)
  • It's possible to have different languages within the same file.  Visual Studio will default to the last choice you made.

 

What does an ASPX page look like?

  • No meta tags - exactly what you would have written in Notepad - no grid layout attribute.  Built into the tool - no meta tags
    • Looks exactly the same in Notepad
    • Focus on simplified model to avoid the need for attributes.
  • Uses code-behind - partial class
    • No initialize form or wire up.
    • Just simple event handler code, like in the old VB 6 code editor.
  • Code-behind or not
    • Code behind is better for cleanliness
    • Now better OO and more approachable
  • Controls
    • Guided UI improves UI
    • Label has no default text.  Scott: 'I've never seen anyone who's benefitted from the default label text

 

What are the upgrade issues from V1.1 to 2.0?

  • Nothing - existing code-behind uses partial
  • No code deleted - just comment out - e.g. the wire-up
  • Open project will prompt you to upgrade to Whidbey - saves a backup first.

 

No IIS setup for file project

  • Runs Cassini webserver on port 15630 for example
  • Debug with F5 - no debugger extensions are required in the code. 
  • Using Casini wont lock up the web server - it's a much easier overall experience.
  • The idea is the For 95% on application development, developers will use Casini on their local box and only shift to an IIS production box at the end of the dev cycle.
  • Still need to enable SQL debugging on the server.

 

Tactical updates

  • Even with code-behind save, refresh and the page is updated on the next refresh.  If you make a quick change you don't need to change the entire project.
  • There is a Build menu that allows you to validate the current page or validate the whole web.

 

How does it work out the back?

  • A file system directory - dynamically build - same compiler locally and the server
  • You can precompile everything into a single assembly!  Including ASCX files for User Controls

 

HTML Formatting Improvements

  • Where do tags begin and end?
  • Click on a tag and match the end tag - the editor highlights the begin and end tag.
  • Similar to FrontPage tag navigator at the bottom of the screen.  Can highlight the inner content or collapse tag.
  • Cursor stays on selection across design and source views.
  • Tag navigator works in even in the designer.
  • Only edit the small tag you are editing - doesn't munge the HTML.

 

Formatting rules

  • You can set rules on capitalization, tag ending, wrapping.
  • Tag ending choices include self terminating, separate closing tag, line breaks before and after and indenting of content.
  • Put a lot of emphasis of whitespace  if there is a non-significant tag space.  A space makes it go to a next line, otherwise use the previous tag's formatting.

 

IntelliSense Improvements

  • There is IntelliSense on the page directives.  It knows what Master Pages are available for instance and shows them as a drop-down.
  • IntelliSense on types has 'common' and 'all' tabs to separate long lists of methods.

 

Other Editor Improvements

  • As tables were drawn the display showed the number of pixels that each cell was taking - a nice piece of visual feedback.
  • It's possible to insert DHTML layers into HTML and manipulate them in the editor.
  • ASCX files can be dropped onto ASPX files and will display visually (rather than the placeholder image used in previous ASP.NET versions).  You can't edit the ASCX files but it is possible to jump to the ASCX file to do the editing.

 

Build and Deployment

There are two main approaches to deploying a web

  1. A Copy Web Option - shows an upload form, very similar to that in FrontPage 2003 that allows to load from local to remote, vice-versa or synchronize both based on the latest
  2. A Publish Web Wizard - This allows for a full pre-compilation of the entire site.  The tools strips out all of the HTML and ASPX code and can deploy as a single binary (this isn't possible using ASP.NET 1.1 and Visual Studio 2003).  There are stubs created for each physical file so that you can set ACL security on the files, but they are all 1KB files with 'stump' text inside them ('This is a marker file generated by the tool …').

 

Data Perspective

  • An object can be set up as an object data provider.  Provided the method is public and supports either IEnumberable or Object it can be hooked up as a provider.  In the demonstration a List<Customer> was provided, supporting IEnumberable and Generics.
  • It's easy to do master/detail pages (easier I'd say that using Access.  It's incredible but ASP.NET is almost a better UI and layout tool than any previous technology has given us!).
  • Enabling paging and sorting is simply a matter of selecting a couple of checkboxes!
  • Each web.config section can be encrypted individually!
  • To add a master/detail page Scott chose Add Column on the grid, chose a Hyperlink Column, provided the URL to the detail page with a query string, passing the ID of the chosen row.
  • There is a DetailsView control.  The wizard lets you select what to bind to (database, object etc).  It's possible to create select, insert, update and delete commands in the wizard.  They can use parameters from source such as a form, a querystring, the profile or session objects.
  • How do you handle a million records?  A middle-tier page or a data access page - data access will only pull the current page back from the server db.
  • How does viewstate work?  It's optional for all the data controls.  It will be turned off by default in order to cut down on page size - the team have noticed that many groups have left this on when they don't need it - adding to the size of the pages.
  • Adding three tier binding was as simple as creating an object with public methods to handle the CRUD style applications (no attributes or interfaces were necessary!).

 

Output Caching

  • Output caching works in V1 using page directives and command likes VaryByParm.  What would be better is to always cache until the underlying data changes - it would be great if there was some way of receiving a notification.
  • Enter Database dependency caching.  This was a simple matter of adding a SqlCacheDependency section to the web.config.
  • Underneath the covers there's a background polling mechanism - a single connection polls for changes to all of the dependencies.  Yukon will shift from polling to push notifications.

 

Themes and Skins

  • Adding themes for ASP.NET like CSS for HTML pages is easy.
  • First all of the formatting is removed from the controls, then in a page directive 'theme=SmokeAndGlass' and all of the pages have the same look and feel.
  • There are around 10 themes shipping out of the box.
  • The skin files are the same control definitions same as ASPX - it's possible to copy and paste - instead of ID you can have a skinid.  If there is no skinid then this is taken as the default look and feel.
  • The hope is in future there will be a theme gallery on the asp.net site where more can be downloaded.

 

Creating Master Pages

  • A master page looks like a regular ASPX page except for two things:
    • In the page directive this is marked as a MasterPage.
    • On the surface it's possible to use content place holders that define regions that pages based on this master can implement.  In this demo it was a simple title bar and side pane, with a central table cell content place holder that could be modified.
  • The content place holders can be blank or have default text.
  • To create pages based on the master page, a masterPage attribute is placed in the page directive (again, IntelliSense works it out and displays the available page masters automaticaly).
  • In the child controls, only the content from the overidable content place holders is persisted to file (e.g. there's no need for the HTML header and body tags in child pages).

 

Creating a Site Map

  • It's simple to create a site map, an xml file with <sitemap> and <sitemapnode> xml elements.
  • This is a datasource that can be hooked to treeview controls, or bread-crumb controls.
  • The Provider model makes it easy to plug and replace with different data sources.

 

Security

  • This was a stunning part of the demo.  Basically ASP.NET Whidbey supports controls like a LoginControl that comes with check boxes for 'remember me' and authentication. 
  • There is a LoginView control that lets you write text that works out whether the user is logged in or not (e.g. a hello message, or a log in/log out label).
  • This can all be based on roles as well.
  • There's full support for login, user creation and even password reset with email functionality all through controls.
  • The Provider model means that this can easily be made to work with different backends with little code.
  • It's possible to change controls with a 'convert to template' method that basically explodes the control out into HTML that can be fully modified.  Inside the file it's treated as a <layout template> section.

 

WebParts

  • ASP.NET Whidbey will support WebParts.  This provides an easy way for users to customise the look and feel experience.
  • The user controls are registered with directives
  • Whidbey includes WebPartZones that define where WebParts can be placed.
  • There's full support for editing the WebParts, similar to SharePoint.
  • It's possible to just drop ASCX files into a WebPart zone and you're done (this is much, much easier than today when you have to inherit from WebPart and implement the RenderWebPart method).
  • The WebPart settings are saved into the Personalization system, meaning you don't have to write any code for the site to remember the users settings.
  • Scott didn't mention it, but WebParts are also an excellent way of sharing functionality with Administrators of sites who want to choose what functionality to display but will lock it down before users see it.

 

How to Localize Pages

  • Pulls all of the control text properties into a resource file in a LocalResources directory.
  • Create res.country file (e.g. resources-en-gb.resx).
  • Uiculture in a page directive hooks it up.
  • Uiculture = auto - gets it from the HTTP headers.
  • Can get the strings via code as well.
Copyright 2003 Benjamin Mitchell