what’s new in asp.net 4
DESCRIPTION
With the recent release of ASP.NET 4.0, there are many new tools in the WebForms developer toolbox that make it possible to build faster, more standards-compliant web applications. In this session, you'll be introduced to all of the new major features in ASP.NET 4.0 and shown how these features can be leveraged to build better WebForms applications. From improved ViewState handling to powerful control over client IDs and caching, this session is your primer for making the upgrade to 4.0.TRANSCRIPT
10 % Read
20% Hear
30% See
50% Hear + See
70% Say + Write
90% Experience
You generally remember…
Todd AnglinChief Evangelist, TelerikMicrosoft MVPASPNET InsiderNHDNUG President & O’Reilly Author
@toddanglin
telerikwatch.com
Telerik
One-stop provider for .NET tools & UI components
UI DATA PRODUCTIVITY TESTING TFS CMS
UI: ASP.NET AJAX, MVC, WinForms, Silverlight, WPFDATA: Telerik Reporting, OpenAccess ORMPRODUCTIVITY: JustCodeTESTING: WebUI Test StudioTFS: Work Item Manager, Project DashboardCMS: Sitefinity CMS.NET Developer Productivity
Today’s Road Map
Web Developer Landscape
What’s New Overview
What’s New Demos
Dynamic DatajQuery & MVCWhat’s Next
What are the technologies of the web?
Web Development
CSS
Java Script
HTML
jQuery
Memory Lane
1991
1993
19961998
2002CSSASP 1.0
At the time of ASP.NET 1…
JavaScript was a pain– But, IE6 held 96% browser share
.NET was brand new– WinForms was new, VB6 was popular
Yet to be invented:– AJAX*– jQuery– Web 2.0– Silverlight/XAML– Twitter
Cloud
JSON
REST Web Services
AJAX RIA
WebMatrix
MVC
Video
HTML5
CSS3
Mobile
Browser War IISocial Media
4
What is “ASP.NET”?
Core Services WebForms MVC Dynamic
Data AJAX
ASP.NET
HTML + JS asp.net webforms
On the Metal
Abstracted
asp.net mvc
introduction to asp.net 4.0
putting you in control
ViewState Control IDs Caching
Extensibility Control Rendering URLs
HTML + JS asp.net webforms
On the Metal
Abstracted
asp.net mvc
*important notes– Side-by-side enabled– Backwards & Upwards compatible
• controlRenderingCompatibilityVersion– VS 2010 only
ViewState can be opt-in
ViewStateModeEnabled/Disabled/Inherit
ViewState
4 Mode:– AutoID – Static– Inherit– Predictable (*default)
(+ ClientIDRowSuffix)
Control IDs
<!--Set client ID--><asp:ListView DataSourceID=“odsYourData" ClientIDRowSuffix="ID" ClientIDMode="Predictable"
<!--Global config-><system.web> <pages clientIDMode="Predictable"> </pages> </system.web>
Improved in 4.0
Routing
public class Global : System.Web.HttpApplication{ protected void Application_Start(object sender, EventArgs e) { RouteTable.Routes.Add("Product", new Route("Products/{category}", new PageRouteHandler("~/Products.aspx"))); }}
<asp:Literal Text="<%$ RouteValue:Category %>" runat="server" />
Global.asax
New APIs
Page.MetaDescription = "this is meta description";Page.MetaKeywords = "this is a meta keyword";
Page Meta Info
Response.RedirectPermanent(url); //issues HTTP 301
Permanent Redirect
HttpRequest.Browser.HttpBrowserCapabilities
Browser Capabilities (updated for new browsers + mobile)
Provider-based
Output Caching
<!--web.config--><caching> <outputCache defaultProvider="AspNetInternalProvider"> <providers> <add name="DiskCache" type="Test.OutputCacheEx.DiskOutputCacheProvider,
DiskCacheProvider"/> </providers> </outputCache> </caching>
<%--Configure cache provider per page/control--%><%@ OutputCache Duration="60" VaryByParam="None" providerName="DiskCache" %>
?
Newly extensible:– Object Caching
• System.Runtime.Caching
– Invalid Path Characters– Request Validation– Encoding
• <httpRuntime encoderType="Samples.MyCustomEncoder, Samples" />
– Browser Capabilities
Extensibility
New– QueryExtender
Improved– ListView– FormView– Paging– Outer tables– Hidden DIV CSS
Controls
Client-side libraries
Microsoft Ajax Libraries are dead*– Long live jQuery
What does it mean?For new client-side development, use jQuery
*NOTE: jQuery ships with ASP.NET 4
Dynamic Data
Core benefits:– Model-driven validation– Field Templates
Now more
flexible!
//Enable via CodeGridView1.EnableDynamicData(typeof(Product),
new { ProductName = "DefaultName" });
<!--OR Enable declaratively on page-%><asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true"> <DataControls> <asp:DataControlReference ControlID="GridView1" /> </DataControls> </asp:DynamicDataManager>
jQuery & MVC
Baked-in to ASP.NET
What’s Next
Razor & WebMatrix
For your research…
Changes to control renderingNew control featuresClient controls & Ajax librariesIIS changesVS 2010 changesASP.NET MVC 2Windows Azure
It’s too much!
Additional ResourcesWhat’s New in Microsoft ASP.NET 4 Web Forms and Dynamic Data– http://www.microsoftpdc.com/2009/FT58
Extensible output caching– http://www.4guysfromrolla.com/articles/061610-1.aspx
(Disk Cache Example Code)
WebForms Routing– http://www.west-wind.com/weblog/posts/54760.aspx
(Good discussion of ClientIDMode on Rick’s blog)