What’s new in ASP.NET 4.5 and Visual Studio 11 Tooling

19
What’s new in ASP.NET 4.5 And Visual Studio 11 Jurgen Postelman s U2U

description

The first session dives right into what’s new in the platform and in Visual Studio tooling for web development. We’ll cover the new HTML, JavaScript and CSS editors and use the new Page Inspector to debug HTML output and more. This session finishes with ASP.NET Web Pages 2 in combination with the Razor syntax, a new approachable and lightweight way to create web content. A great starter to kick-off the day!

Transcript of What’s new in ASP.NET 4.5 and Visual Studio 11 Tooling

Page 1: What’s new in ASP.NET 4.5 and Visual Studio 11 Tooling

What’s new in ASP.NET 4.5 And Visual Studio 11

JurgenPostelmansU2U

Page 2: What’s new in ASP.NET 4.5 and Visual Studio 11 Tooling

Session Contents• Visual Studio 11 Enhancements• Unobtrusive Validation• Request Validation Enhacements• Cross Site Scripting• Bundling and Minification

Page 3: What’s new in ASP.NET 4.5 and Visual Studio 11 Tooling

Visual Studio 11

• IIS Express by default for new Web Sites• ASP.NET Development Server still included for backward

compatibility• LocalDB default database server• ASP.NET Project Templates (not implemented yet)• Unify all templates over Web Forms, MVC and Web Pages• Build in mobile support

Page 4: What’s new in ASP.NET 4.5 and Visual Studio 11 Tooling

HTML Editor Enhancements• Source View Smart Tasks• Automatic Event Handler generation

• Element Matching• Extract To User Control• Highlight the a piece of code, right-click and select Extract

to User Control in menu• Smart Indentation

Page 5: What’s new in ASP.NET 4.5 and Visual Studio 11 Tooling

HTML5 Enhancements

• ASP.NET Web Forms defaults to XHTML5 doctype• ‘Use DocType’ button in toolbar

• Support for new HTML5 form controls• Enhanched TextMode property on TextBox control

Page 6: What’s new in ASP.NET 4.5 and Visual Studio 11 Tooling

CSS Editor Enhancements• CSS Editor Hierarchical Indentation• CSS Editor Snippets• CSS Color Picker• Better Cross Browser support

Page 7: What’s new in ASP.NET 4.5 and Visual Studio 11 Tooling

Javascript Editor Enhancements• Support for ECMAScript 5 and HTML5 DOM• Auto-reducing Statement Completion List in

IntelliSense• IntelliSense show function signature• Support for • Go To Definition• Brace Matching• Outlining

Page 8: What’s new in ASP.NET 4.5 and Visual Studio 11 Tooling

Page Inspector• Delivers integrated browser experience in Visual

Studio• Installed separately via Web Platform Installer

• Live DOM and CSS Visualizer and Editor• Inspect DOM elements• Alter their CSS on the fly

Page 9: What’s new in ASP.NET 4.5 and Visual Studio 11 Tooling

Unobtrusive Validation• In ASP.NET 4.0 Validators generated inline JavaScript

for client-side validation• Increases page size• HTML source is cluttered

• Unobtrusive Validation uses HTML5 data attributes and jQuery

• Enabled by default via web.config or in code

Page 10: What’s new in ASP.NET 4.5 and Visual Studio 11 Tooling

Request Validation• In ASP.NET 4.0 • Request validation enabled by default and could only be

disabled at the page level

Page 11: What’s new in ASP.NET 4.5 and Visual Studio 11 Tooling

Request Validation• ASP.NET 4.5 enhancements• Disable request validation on a single control• ValidateRequestMode attribute on ASP.NET Control

• Lazy Request Validation• Validation only done when value is accessed explicitly

• i.e.: Request.Form[“<key>”]• In web.config

• Set ValidateRequestMode on control to Disabled• To access the un-validated request manually

• i.e.: Request.Unvalidated.Form[“<key>”]• Be careful with this

Page 12: What’s new in ASP.NET 4.5 and Visual Studio 11 Tooling

Cross Site Scripting • Enables hackers to inject client-site script in your page• Prior to ASP.NET 4.5 the default HTML encoder is

vulnerable to XSS attacks• ASP.NET 4.5 has the AntiXssEncoder builtin• Configured as the default encoder via web.config on new

projects

• Used everywhere except for data binding expressions• Use the new <%#: <your expression> %> syntax there

Page 13: What’s new in ASP.NET 4.5 and Visual Studio 11 Tooling

Bundling And Minification

• Modern HTML pages can include lots of CSS and JavaScript references• Each one is retrieved with a separate HTTP request• Not automatically minified

• ASP.NET 4.5 can bundle and minify your JavaScript and CSS

Page 14: What’s new in ASP.NET 4.5 and Visual Studio 11 Tooling

JavaScript Bundling And Minification• Default JavaScript bundling behavior• Take all JavaScript files in a certain folder • Sort them alphabetically• Then reordered so that know libraries are

loaded first (jQuery, Dojo, MooTools)• The default bundle is called “js”• Include the following script link to load the

default bundle in your page

Page 15: What’s new in ASP.NET 4.5 and Visual Studio 11 Tooling

CSS Bundling And Minification• Default CSS bundling behavior• Take all CSS files in a certain folder • Sort them alphabetically• Then reorganized so that reset.css and normalize.css

come before any other CSS file• The default bundle is called “css”• Include the following script link to load the default

bundle in your page

Page 16: What’s new in ASP.NET 4.5 and Visual Studio 11 Tooling

Bundling And Minification

• You can register your own bundles in Global.asax for custom processing

• Referencing your custom bundle

Page 17: What’s new in ASP.NET 4.5 and Visual Studio 11 Tooling

Q&A

Page 18: What’s new in ASP.NET 4.5 and Visual Studio 11 Tooling

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Page 19: What’s new in ASP.NET 4.5 and Visual Studio 11 Tooling

Be what’s next• Find everything here

http://aka.ms/mbl-tech• Visual Studio Developer Preview Downloads

http://aka.ms/mbl-tech/devprev• MSDN HTML5 Developer Center

http://aka.ms/mbl-tech/html5