What’s new in ASP.NET 4.5 And Visual Studio 11 Jurgen Postelman s U2U
Jan 18, 2015
What’s new in ASP.NET 4.5 And Visual Studio 11
JurgenPostelmansU2U
Session Contents• Visual Studio 11 Enhancements• Unobtrusive Validation• Request Validation Enhacements• Cross Site Scripting• Bundling and Minification
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
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
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
CSS Editor Enhancements• CSS Editor Hierarchical Indentation• CSS Editor Snippets• CSS Color Picker• Better Cross Browser support
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 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
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
Request Validation• In ASP.NET 4.0 • Request validation enabled by default and could only be
disabled at the page level
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
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
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
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
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
Bundling And Minification
• You can register your own bundles in Global.asax for custom processing
• Referencing your custom bundle
Q&A
© 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.
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