Malek KemmouTechnology Architect, Application PlatformMicrosoft Middle East and [email protected]
Overview of ASP.NET 2.0Overview of ASP.NET 2.0
New Features at a Glance
DataControls
DataControls
LoginControls
LoginControls Web PartsWeb Parts Other New
Controls
Other NewControls
Master PagesMaster Pages Themesand Skins
Themesand Skins LocalizationLocalization CompilationCompilation
MembershipMembership RoleManagement
RoleManagement ProfilesProfiles ConfigurationConfiguration
SiteMaps
SiteMaps
HealthMonitoring
HealthMonitoring
OtherServices
OtherServices
Con
trols
Pag
eFr
am
ew
ork
Serv
ices
an
d A
PIs
What's New in Data Access
• Data source controls– Declarative 2-way data binding
• Data controls– GridView - Like the DataGrid, only better– DetailsView - Companion to GridView
• SQL cache dependencies– Key cached items to database entities
• Simplified data binding expressions
Data BindingData Binding
What's New for UIs
• Master pages– "Visual inheritance" for Web pages– Applied declaratively or programmatically
• Themes and skins– Theme controls, pages, and entire sites– Applied declaratively or programmatically
• New controls (more than 50 in all)– Menus, TreeViews, Wizards, and more
Theming a Page
<%@ Page Theme="BasicBlue">
Before After
Master PagesMaster Pages
What's New in Security
• Membership service– Service for managing users and credentials– Provider-based for flexible data storage
• Login controls– Controls for logging in, creating new users,
recovering lost passwords, and more
• Role Management service– Combine forms authentication and role-
based authorization without writing code!
Membership and LoginsMembership and Logins
Profiles
• Store per-user data persistently– Strongly typed access (unlike session state)– On-demand lookup (unlike session state)– Long-lived (unlike session state)– Supports authenticated and anonymous
users
• Accessed through dynamically compiled HttpProfileBase derivatives (HttpProfile)
• Provider-based for flexible data storage
Defining a Profile
<configuration> <system.web> <profile> <properties> <add name="ScreenName" /> <add name="Posts" type="System.Int32" defaultValue="0" /> <add name="LastPost" type="System.DateTime" /> </properties> </profile> </system.web></configuration>
Persisting Data with ProfilesPersisting Data with Profiles
Site Navigation
• Navigation UIs are tedious to implement– Especially if they rely on client-side script
• New controls simplify site navigation– TreeView and Menu - Navigation UI– SiteMapDataSource - XML site maps– SiteMapPath - "Bread crumb" control
• Public API provides foundation for controls• Provider-based for flexibility
Data-Driven Site NavigationData-Driven Site Navigation
Providers
• New model for storing and managing state– Makes storage adaptable to different media
• Used by many key ASP.NET services– Membership service– Role Management service and more
• Built-in providers make ASP.NET state storage very flexible
• Custom providers make it infinitely flexible
The Provider Model
Membership API
MembershipData
Access OtherData Stores
Controls LoginLogin LoginStatusLoginStatus LoginViewLoginView
AccessMembershipProviderAccessMembershipProvider Other MembershipProviders
Other MembershipProviders
Membership Providers
MembershipMembership MembershipUserMembershipUser
SqlMembershipProviderSqlMembershipProvider
SQL Server
Other LoginControls
Other LoginControls
Configuration
• Administrative tools– ASP.NET MMC snap-in– Web Site Administration Tool
(Webadmin.axd)
• Configuration API– Read/write access to configuration settings– Simplified custom configuration sections
• Instrumentation– Perf counters, health monitoring, and more
Web Parts
• Framework for building portal-style apps– Patterned after SharePoint Portal Server– System.Web.UI.WebControls.WebParts
• Rich UIs with minimal code– Edit page layout using drag-and-drop– Edit appearance and behavior and more
• Seamless personalization
• Intercommunication ("connections")
Web PartsWeb Parts
What's New in Mobility
• Unified Control Architecture– Adapters enable pages and controls to render
markup for different device types– WML adapters provided by third parties
• Device filters
<asp:Label Text="Hello, world" RunAt="server" Nokia:Text="Hello, Nokia" Up:Text="Hello, OpenWave" />
Nokia browsers
OpenWave browsers
What's New in Localization
• Auto-culture handling– Declarative mapping of Accept-Language
headers to relevant thread properties
• Simplified resource handling– Declarative mapping of control properties
to resources using <%$ … %> expressions– Strongly typed programmatic resource
loading
• <asp:localize runat="server"> and more
Code-Behind 2.0
<%@ Page CompileWith="Hello.aspx.cs" ClassName="MyPage_aspx" %>
<html> <body> <form runat="server"> <asp:TextBox ID="Input" RunAt="server" /> <asp:Button Text="Test" OnClick="OnTest" RunAt="server" /> <asp:Label ID="Output" RunAt="server" /> </form> </body></html>
Hello.aspx
Code-Behind 2.0, Cont.
using System;
partial class MyPage_aspx{ void OnTest (object sender, EventArgs e) { Output.Text = "Hello, " + Input.Text; }}
Hello.aspx.cs
Cross-Page Posting
• Pages can now post back to other pages• Relevant properties:
– control.PostBackUrl - Identifies postback target– Page.PreviousPage - Returns reference to page
that originated a cross-page postback– PreviousPage.IsCrossPagePostBack - Reveals
whether a cross-page postback occurred
• @ PreviousPageType directive provides strongly typed access to previous page
Posting Back to Another Page
<html> <body> <form runat="server"> <asp:TextBox ID="Input" RunAt="server" /> <asp:Button Text="Test" PostBackUrl="PageTwo.aspx" RunAt="server" /> </form> </body></html>
Get the beta
• http://www.microsoft.com/betaexperience
• Fill out the form, and you’ll get the DVD (no cost, not even shipping!!!)
Questions