ASP.NET Overview Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland
Agenda Introduction Master Pages Data access Caching Site navigation Security: users and roles Themes/Skin AJAX Support (WPF / Silverlight)
ASP.NET (Active( Server Pages.NET) Web Application Framework (part( of.net Framework current Version 3.5) to build dynamic web sites and web services Tools Visual Web Developer 2008 Express Edition (for free) Visual Studio 2008 Professional Visual Studio 2008 Team System Solution deployed on IIS (For development no IIS required Built-in in ASP.NET web server)
Visual Studio 2008 tour
ASP.NET Server Controls Server Controls encapsulate both behaviour and rendering Declarative, specified by runat= server server Generate HTML that is sent to the client Can support multiple client types
Web App
ASP.NET Architecture Stack App Services Page Rich Controls Data Controls Login Controls Navigation Controls WebParts Master Pages Themes/Skins Adaptive Mobility Personalization Membership Role Profiles Site Maps Health Monitoring Caching Configuration Extensible Provider Model: SQL, Access, Windows, Oracle
Some Membership Provider (Pattern Strategy) Membership System.Web.Security.ActiveDirectoryMembershipProvider System.Web.Security.SqlMembershipProvider Role management System.Web.Security.AuthorizationStoreRoleProvider System.Web.Security.SqlRoleProvider System.Web.Security.WindowsTokenRoleProvider Site map System.Web.XmlSiteMapProvider Profile System.Web.Profile.SqlProfileProvider
Master Pages Work Design time MySite.master <%@ Master %> Header Navigation <asp:contentplaceholder Id=MainContent /> Default.aspx <%@ Page MasterPageFile= ~/MySite.master %> <asp:content ContentPlaceHolderId=MainContent /> Footer
How Master Pages Work Runtime http://servername/sitename/default.aspx Header Navigation Default page content Footer Default.aspx s content replace the contentplaceholder of the master page at runtime
Master Pages
Data Controls Provides easy and powerful declarative model Goal: All common data access scenarios with zero code Do not require developer to be aware of page lifecycle events Enable rich and pluggable data access storage providers
Data Controls Data Source Controls: <asp:sqldatasource> <asp:accessdatasource> <asp:xmldatasource> <asp:sitemapdatasource> <asp:objectdatasource> <asp:linqdatasource> Data Bound Controls: <asp:gridview> <asp:detailsview> <asp:treeview> <asp:menu
Data Source Controls Declarative ("no-code") data binding Part of.aspx. files Sql- DataSource Object- DataSource Access- DataSource Xml- DataSource SiteMap- DataSource Data Component Site Map Provider SQL Databases Any Data Access Databases XML Data Site Maps
Data-Bound Controls GridView DetailsView FormView Built-in in support for selecting, editing, paging, sorting, and more Visual Studio makes it simple to configure and connect data controls to datasources!
Data Controls
Caching V1 Caching allowed timer based invalidation Sites often set low cache duration in order to maintain accuracy of content backed by databases V2 now supports cache invalidation providers Custom Cache Dependency (inherits from CacheDependency) Built-in in support for SQL Cache Invalidation Works with (SQL 7), SQL 2000 and 2005 Table invalidation for (SQL 7) + 2000, row for 2005 Enabled for both output cache entries and cached data- structures
Site Navigation Built-in in site layout and navigation system Built-in in support for XML site description (App.SiteMap( App.SiteMap) Provider model for alternate stores (example: database) Programmatic API Enables Access to Site Layout Where you are in the site, link structure, paths, etc. Rich server controls encapsulate common tasks <asp:sitemappath> -- Bread-Crumb Control <asp:sitemapdatasource> -- DataSource Control <asp:treeview> -- Hierarchical tree control <asp:menu> -- Rich navigation menu control <asp:wizard> -- Control for multi-step state processes
Site Navigation
Login Controls (Users & Roles) Control suite built on Membership/Roles APIs: <asp:login> -- Login Form <asp:loginname> -- Output authenticated name <asp:loginstatus> -- Indicate whether authenticated <asp:loginview> -- Template driven views <asp:passwordrecovery> -- Email lost password <asp:createuser> -- Create new account <asp:changepassword> -- Change password
Security
Themes/Skinning Themes are rich skin templates that can be applied to pages and controls Enable customization of both style and structure Can be dynamically set at runtime (personalization) Themes encapsulated within.skin files Stored within \themes directory of application Contain pre-defined set of control property values Theme picked via Page.Theme property
Themes
What is ASP.NET AJAX? A Framework for building Richer, more Interactive, Standards-based Web Experiences High Productivity AJAX Development Framework Fewer concepts, fewer lines of code Application and UI building blocks for common scenarios Builds on Top of ASP.NET 2.0 Well integrated with design and development tools Seamlessly integrated application model Works with ASP.NET pages and server controls Allows access to ASP.NET web services and components Standards-Based: Works Cross-Browser!
AJAX
SUMMARY ASP.NET is a Technology (no language) ASP.NET languages are compiled (better performance compared to interpreted languages) Separation between UI and logic (.aspx /.aspx.cs. aspx.cs).net Libraries available inside ASP.NET Dramatically reduce development time + costs Similar programming model to other.net Application Easy AJAX integration Totally Extensible Platform Replace/extend all built-in in features + services Customize for any enterprise environment
References ASP.NET Quickstart Tutorial! ASP.NET on MSDN Visit www.asp.net/ for more info Hosting PHP on IIS7 (www.iis.net/( www.iis.net/php)
2007 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.