Escolar Documentos
Profissional Documentos
Cultura Documentos
This post explains bundling and minification support in ASP.NET 4.5 Web Forms.
Support (Scott Guthrie's blog) Using Page Inspector in ASP.NET Web Forms (ASP.NET website)
Forms. This topic introduces Page Inspector (visual mapping between the browser, source view, and CSS) within the context of a Web Forms project.
ASP.NET MVC
Title Intro to ASP.NET MVC 4 with Visual Studio 2012 Using Asynchronous Methods in ASP.NET MVC 4 ASP.NET MVC 4 Mobile Features Using Page Inspector in ASP.NET MVC Using Page Inspector in ASP.NET MVC (video) Description This tutorial will teach you the basics of building an ASP.NET MVC Web application using Visual Studio Express 2012 for Web. This tutorial series will teach you the basics of building an asynchronous ASP.NET MVC 4 application.
This tutorial will teach you the basics of how to work with mobile features in an ASP.NET MVC 4. This topic introduces Page Inspector (visual mapping between the browser, source view, and CSS) within the context of an ASP.NET MVC project. This video shows the benefits of using Page Inspector in ASP.NET MVC web applications.
Web Developer Efficiency Tools in Visual Studio (Channel 9 video) My Top 5 Visual Studio Designer Improvements for ASP.NET 4.5 Development (Telerik) (Telerik blog)
This article documents common tasks that you can perform using new features in ASP.NET Web Pages. This tutorial set uses the WebMatrix tool to provide an overview of ASP.NET Web Pages 2 and Razor syntax.
This blog entry covers new features like updated support for the ~operator and the new conditional attributes.
This blog entry is the first in a series of three that explores the new V l d t o aiain helper in ASP.NET Web Pages 2.
reading and writing HTTP requests and responses Support for reading unvalidated request data when request validation is enabled Support for WebSockets protocol
asynchronicity lets you send data to a client incrementally without tying up operating system threads.
Reading and Writing HTTP Requests and Responses (What's New whitepaper)
ASP.NET 4.5 provides ways to read unvalidated request data so that you can allow users to pass markup for selected fields or pages.
Methods in the new System.Web.WebSockets namespace provide support for WebSockets protocol, which lets you read and write both string and binary data.
ASP.NET 4.5 uses bundling (which combines separate JavaScript files for faster loading) and minification (which reduces the size of JavaScript and CSS files by removing unneeded characters). The ASP.NET bundling and minification library is also supported by the ScriptManager control.
New Bundling and Minification Support (ASP.NET 4.5 Series) (blog entry) Bundling and Minification (article) Bundling and Minification in ASP.NET 4.5 (blog entry)
The new async and await keywords make it easier to write asynchronous HTTP modules and asynchronous HTTP handlers. Updates to asynchronous development include: ClientDisconnectedToken : A CancellationToken that asynchronously notifies the application when a client has disconnected from the underlying web server. TimedOutToken : A CancellationToken that asynchronously notifies the application when a request has run longer than the configured request timeout value. ThreadAbortOnTimeout : If you want your application to control the behavior of timed out requests, set this property to false. When the property is set to true (the default), ASP.NET aborts the thread that is servicing the request when the request times out. Abort : Use this method in your application to forcibly terminate the underlying TCP connection of a request. Any outstanding I/O will fail.
Support for await and Task-Based Asynchronous Modules and Handlers (What's New whitepaper) Using Asynchronous Methods in ASP.NET 4.5 (tutorial) Using Asynchronous Methods in ASP.NET MVC 4 (tutorial) async (C# Reference) (MSDN Library) await (C# Reference) (MSDN Library) Anti-XSS Library (What's New whitepaper)
Anti-XSS (cross-site scripting) core encoding routines have been integrated into ASP.NET 4.5. These routines were previously available only as an external library. OAuth and OpenID let you create sites that permit users to sign in
OAuth and OpenID let you create sites that permit users to sign in with credentials from other sites, including Google, Yahoo, Facebook, Twitter, and Windows Live.
For more information, see Whats New in ASP.NET 4.5 and Visual Studio 2012 on the ASP.NET website.
networks (CDNs) in the ScriptManager control Support for HTML5 form types You can use HTML5 elements like e a l t l u l and s a c mi, e, r, erh in Web Forms pages.
HTML5 Updates (What's New whitepaper) HTML 5 Input Types on WebForms Controls (blog entry)
The new AllowCustomPaging and VirtualItemCount properties of the GridView control let you customize paging functionality. These new properties remove the need for the control to retrieve all rows from the data source each time a new page is displayed. The following improvements extend the Web Forms compilation system: - A new ControlBuilderInterceptor class lets you customize Web Forms page and control compilation output. - A new TemplateParser.ParseTemplate method lets you generate an ITemplate instance from a string of ASPX markup.
AllowCustomPaging (MSDN Library) VirtualItemCount (MSDN Library) ControlBuilderInterceptor (MSDN Library) ParseTemplate (MSDN Library) ITemplate (MSDN Library) Visual Studio 2012 RC is released - The Big Web Rollup (Scott Hanselman blog)
For more information, see Whats New in ASP.NET 4.5 and Visual Studio 2012 on the ASP.NET website.
ASP.NET MVC 4
ASP.NET MVC 4 is available for Visual Studio 2010 SP1 at the Microsoft Download Center and for Visual Studio 2012 at ASP.NET MVC 4. For information about new features in this release, see the following links on the ASP.NET website: ASP.NET MVC 4 Release Notes Using the HTML5 and jQuery UI Datepicker Popup Calendar with ASP.NET MVC ASP.NET MVC 4 Mobile Features
The following table lists enhancements for ASP.NET Web Pages that are included in the Web Pages 2. Feature New and enhanced site templates Description A new Personal Site template provides pages for a blog, a photo gallery, and Twitter content. The Starter Site template has been updated to let users log in to your site by using Facebook, Twitter, and Windows Live. The Web Pages 1 site templates have also been upgraded to run on Web Pages 2. Resources The Top Features in Web Pages 2 (ASP.NET website) The Top Features in Web Pages 2 (ASP.NET website) Validation New options for validating user input are available, including client-side validation (which helps improve the performance of your site). New validation classes (ValidationHelper and Validator) help you specify validation rules by using just a few lines of code. The Top Features in Web Pages 2 (ASP.NET website) The Top Features in Web Pages 2 (ASP.NET website) Membership and authentication Web Pages supports new OAuth and OpenID authentication providers, which let users log in using external sites such as Facebook, Twitter, and Windows Live. The new Starter Site template includes examples of how to use the new providers. The Top Features in Web Pages 2 (ASP.NET website) Map helper A new Map helper lets you call existing map engines (such as Bing, Google, Yahoo, and MapQuest) and render maps on your website. The Top Features in Web Pages 2 (ASP.NET website) Mobile display modes A new Display Modes feature lets you create device-specific pages. The pages are rendered automatically based on the device that makes the request, such as a mobile device. The Top Features in Web Pages 2 (ASP.NET website) For more information about the ASP.NET Web Pages 2 release, see The Top Features in Web Pages 2 on the ASP.NET website.
Razor syntax now supports conditional HTML attributes, which makes it much simpler to render attributes based on values that you set in code. The new ~ / syntax also now makes it much simpler to render dynamic path information in links and URLs.
Side-by-side support
You can run existing Web Pages 1 applications and new Web Pages 2 applications on the same computer.
ASP.NET MVC 4, Web API, and ASP.NET Web Pages (Razor) are now Open So urce
ASP.NET MVC 4, ASP.NET Web API, and ASP.NET Web Pages v2 (Razor syntax) are now under the Apache 2.0 license. The essential points of this development model are as follows. Source code location. The source code is available on CodePlex at http://aspnetwebstack.codeplex.com/ and uses Git for version control. See check-ins and provide feedback. The community can see and provide feedback on developer check-ins both from Microsoft and from the community. Community contributions. Developers outside of Microsoft community can submit patches and code contributions. Check-ins are evaluated. The Microsoft development team reviews every check-in (open source or otherwise) for inclusion. Every check-in is evaluated against existing standards. Community code is included in Visual Studio. The community code approved for inclusion in ASP.NET is included in Visual Studio. Microsoft development and support continue. ASP.NET MVC, Web API and Razor continue to be developed by Microsoft and ship both standalone as well as part of Visual Studio. They continue to be supported by existing Microsoft support policy. Web Forms. Web Forms has not been made open source because it is part of System.Web.dll which the Windows Server platform takes a dependency on. Because of this dependency, the code cannot easily be replaced except when the .NET framework or the OS are updated. For more information, see: ASP.NET MVC, Web API, Razor and Open Source (ScottGus blog) ASP.NET MVC 4, ASP.NET Web API and ASP.NET Web Pages v2 (Razor) now all open source with contributions (Scott Hanselmans blog)
Editor Enhancements
The following sections provide information about editor enhancements and new features in the Visual Studio 2012 release. Note The HTML5 and CSS3 features included in the Web Standards Update for Microsoft Visual Studio 2010 SP1 release are also in Visual Studio 2012. The following features in the web page designer are either new or have been enhanced for the Visual Studio 2012 release.
release. Multibrowser Support Page Inspector HTML Editor CSS Editor JavaScript Editor
Multibrowser Support
Installed browsers appear in a new drop-down list next to the Start Debugging button in Visual Studio. This feature lets you test the same page, application, or site in different browsers. To test in several browsers simultaneously, choose the Browse With option from the drop-down list, and then use CTRL-click to select multiple browsers. When you press F5 or CTRL+F5, your application will launch in all of the browsers that you selected. To set multiple browsers as the default, use Browse With to select multiple browsers, and then choose Set as Default from within the Browse With dialog box.
Page Inspector
Page Inspector is a tool that renders a web page (HTML, Web Forms, ASP.NET MVC, or Web Pages) directly within the Visual Studio IDE. You can use Page Inspector to examine both the source code and the resulting output. For ASP.NET pages, you can use Page Inspector to determine which server-side code has produced the HTML markup that is rendered to the browser. Page Inspector works even when the default ASP.NET bundling and minification features are enabled. Requirements To use Page Inspector, you must have the following: Visual Studio 2012 installed on your computer. .NET Framework 4.5 installed on your computer. A Web application that targets the .NET Framework 4 or later.
Note Page Inspector hosts the current version of Internet Explorer in Visual Studio. For full functionality, you must have Internet Explorer 9 installed on your computer. You do not have to have Internet Explorer Platform Preview (also called Internet Explorer 10 Test Drive) installed. Features Feature Description
When you select markup in the source, the corresponding output is automatically highlighted in Page Inspector, and vice versa. Click the arrow icon on the Page Inspector tools pane to put Page Inspector into inspection mode. In inspection mode, when you hold the mouse pointer over any part of the rendered page, the corresponding source markup or code is highlighted. In Solution Explorer, the corresponding file is also highlighted. Page Inspector lets you modify CSS properties and DOM element attributes and see the changes reflected immediately in the browser. These changes are not persisted and the original source files are unaffected.
Sandbox testing of CSS/DOM changes CSS Rule Mapping and Modification Update bar
When you click a rule in the CSS tools grid, Page Inspector opens the corresponding .css file to where the rule is defined. The complete rule is selected. This feature makes it easy for you to get to where the rule is defined so that you can modify it as necessary.
When you change the page source, an update bar appears at the top of the viewer. The Update Bar prompts you to click the bar (or press CTRL+ALT+ENTER) to save the changes and refresh the rendered view.
Source file links Page Inspector in the default browser list Resources
A Files tab on the Page Inspector tools pane contains links to all of the files that make up the current page. To open one of the files in the Visual Studio editor, click the file link. Page Inspector appears as an option in the drop-down list of browsers next to the Start Debugging icon in Visual Studio.
Page Inspector Release Notes Page Inspector for Visual Studio (MSDN blog) Page Inspector - Introduction (video) Page Inspector - Decomposing your Web Application (video) Using Page Inspector in ASP.NET MVC (tutorial) Using Page Inspector in ASP.NET MVC (video) Using Page Inspector in ASP.NET Web Forms (tutorial) Web Developer Efficiency Tools in Visual Studio 2012 (video)
HTML Editor
The HTML editor in Visual Studio provides support for HTML5. The following table lists additional enhancements. Feature Improved IntelliSense Description As you type, IntelliSense reduces the options that are displayed to only the ones that contain the string that you typed. Matches can occur at the beginning, middle, or end. IntelliSense and validation have been updated to conform to the latest HTML5 and W3C standards. Schema switching based on document type Tag completion when renaming tags You can configure the HTML editor to use a page's < D C Y E and !OTP> < t l tags to automatically set the schema to use for validating the hm> page markup. Resources Auto-reduce statement completion (What's New whitepaper) Validation, HTML, Text Editor, Options Dialog Box (MSDN UI reference)
If you change a tag name (for example, < >to < i t ), the editor p ls> changes the corresponding beginning or end tag (for example, < p /> automatically becomes < l s > /it.
Automatic renaming of matching tag when you rename an opening or closing tag (What's New whitepaper)
Extract selected markup to a user control Smart indentation for empty elements
In the editor, you can save selected select markup as a user control, which is a convenient way to create markup for use in multiple locations. To do this, right-click the selection, choose Extract to User Control, and then save the markup.
IF the insertion pointer is between an empty pair of tags (for example, < > / > when you press ENTER, the editor creates a new line. It puts p < p ), the insertion point in an indented position on the new line, as in the following example: HTML <> p |/> <p
Smart Tasks appear on HTML tags as a small arrow when the insertion point is inside the element. Click the arrow or press CTRL+. (dot) to display a small menu that helps you complete tasks related to the element. Smart Tasks are available in source view for all HTML elements and are extensible through the Managed Extensibility Framework.
HTML Editor Smart Tasks and Event Handler Generation (blog entry) HTML Editor Smart Tasks and Event Handler Generation (video)
When you edit an event name in source view, you can use IntelliSense to create an event handler in the code that has the correct signature.
For more information, see Whats New in ASP.NET 4.5 and Visual Studio 2012 on the ASP.NET website.
CSS Editor
The most significant change in the Visual Studio 2012 CSS editor is support for CSS3. For more information about CSS3, see www.css3.info. The following table lists additional enhancements to the CSS editor in Visual Studio 2012. Feature Collapse/expand (outlining) Description The expand and collapse feature (outlining) from the HTML page editor in Visual Studio has been added to CSS sections and commented section headings in .css files. Auto formatting When you insert a CSS property, a colon is automatically added. When you type an opening brace ("{"), a closing brace ("}") is added. Parent and child relationships are now indented in the editing pane so that the CSS hierarchy is clearer. Hierarchical indentation (What's New whitepaper) CSS Editor Hierarchical Indentation (video) Auto-reducing statement completion As you type, IntelliSense reduces the options that are displayed to only the ones that are appropriate. IntelliSense displays items that contain the string that you type regardless of whether the string occurs at the beginning, middle, or end of the matching item. The keyboard shortcuts for commenting and uncommenting in the HTML editor (CTRL+K, CTRL+C, and CTRL+K, CTRL+U) are now available in the CSS editor. (When a partially selected commented block is uncommented, the whole block is uncommented.) Color picker When you type # or rgb( after any CSS property that takes a color value, a color picker is displayed that can insert the value for the color. The value is inserted in hexadecimal or other formats into the style sheet. Auto-reduce statement completion (What's New whitepaper) Commenting and uncommenting support (What's New whitepaper) Color picker (What's New whitepaper) CSS Editor Color Resources Custom regions (What's New whitepaper)
Hierarchical indentation
Comment/Uncomment
Picker (video) Snippets for vendorspecific extensions to CSS Snippets facilitate the entry of vendor-specific extensions like m - - o - and - e k t . s, mz, wbiSnippets (What's New whitepaper) CSS Snippets (video) CSS hacks support (What's New whitepaper) Supported CSS module list
Selector and property hacks like * o o and _ i t are clr wdh understood and validated.
The Visual Studio 2012 CSS schema follows W3C standards. For a complete list of the CSS modules supported in Visual Studio 2012, see the resource link. The Visual Studio 2012 CSS editor knows what version of a particular browser supports specific properties, directives, pseudo-classes, elements and values. Supported browsers include Chrome, Firefox, Internet Explorer, Opera and Safari.
What's New in ASP.NET 4.5 and Visual Studio 2012 (What's New whitepaper) Visual Studio 2012 RC is released - The Big Web Rollup (Scott Hanselman blog) What's New in ASP.NET 4.5 and Visual Studio 2012 (What's New whitepaper)
Typing a hyphen in the CSS editor displays a list of all Mozilla, Internet Explorer, Opera, and WebKit vendor-specific prefixes. If you select a prefix in the list with the mouse pointer, a tooltip displays help text for the selected entry.
Examples in tooltips
When you type a property name in the CSS editor, a tooltip displays a helpful example that shows how values should be assigned to the property.
For more information, see Whats New in ASP.NET 4.5 and Visual Studio 2012 on the ASP.NET website and New CSS Editor Improvements in Visual Studio (ASP.NET 4.5 Series).
JavaScript Editor
The JavaScript editor in Visual Studio 2012 offers the following enhancements: Support for ECMAScript5. Numerous IntelliSense improvements. Braces matching. A "Go to Definition" feature that jumps from a variable or function name to its definition when you choose the F12 key.
the F12 key. For more information, see JavaScript Editor on the ASP.NET website.
Data-Related Enhancements
The following table lists some of the data-related changes that have been made in Visual Studio 2012. For datarelated enhancements that pertain to Web Forms, see the ??? ASP.NET Web Forms section in this document. Feature SQL Server Express LocalDB as the default database SQL Server Object Explorer Description SQL Server Express LocalDB replaces SQL Server Express as the default database engine for development. SQL Server Express LocalDB is a lightweight version of SQL Server that has many of the programmability features of a SQL Server database. A new SQL Server Object Explorer in Visual Studio lets you manage database objects in a way similar to SQL Server Management Studio. You can open the SQL Server Object Explorer from the View menu in Visual Studio. A new Table Designer allows you to define a table by using a graphical designer, a script, or both. The script updates automatically as you change the table design in the graphical designer. New DataAnnotations attributes New attributes in the System.ComponentModel.DataAnnotations namespace automate validation for common data types such as email addresses, telephone numbers, and credit card numbers. Selected new attributes are listed in the Resources column. Connected Database Development (MSDN Library) Resources Local Data Overview (MSDN Library)
Table Designer
How to: Create Database Objects Using Table Designer (MSDN Library) CreditCardAttribute (MSDN Library) EmailAddressAttribute (MSDN Library) FileExtensionsAttribute (MSDN Library) MaxLengthAttribute (MSDN Library) MinLengthAttribute (MSDN Library) PhoneAttribute (MSDN Library) UrlAttribute (MSDN Library) The Entity Framework and ASP.NET Getting Started Part 8 (ASP.NET website) Performing Validations (article)
Dynamic Data now supports Entity Framework enumerations and spatial data types. You can now configure DynamicField controls to generate unobtrusive JavaScript for client-side validation. Unobtrusive Validation (What's New whitepaper)
For more information, see What's New for Data Application Development in Visual Studio 2012.
Publish in Visual Studio Preview file and database changes before they are actually made on the destination server Deploy incremental database updates The new preview feature enables you to see which files will be copied or deleted and what database changes will be applied to the database, and you can cancel before the changes are applied. In the case of file operations, you can selectively cancel updates or deletions of specific files. How to: Deploy a Web Application Project Using One-Click Publish in Visual Studio
After a database is deployed and you make new changes to the database schema, when you redeploy the project Visual Studio can automatically determine what changes need to be applied to the database. If you are using Entity Framework Code First Migrations, Visual Studio can automatically configure Code First Migrations to update the database to the latest version when the application runs.
How to: Deploy a Web Application Project Using One-Click Publish in Visual Studio
- A cleaner and simpler publish user interface. - The ability to run Entity Framework Code First migrations from the publish dialog. - The ability to update connection strings in the Web.config file at publish time (including complex EF connection strings). - Prompting for untrusted certificates during publish. - Automatic conversion of Visual Studio 2010 publish profiles to Visual Studio 2012 format. - The ability to publish from the command line using a publish profile. Example syntax follows. mbidmwpcpo sul ya.srj /:elynul=rePbihrfl=yrflNm pDpoOBidtu;ulsPoieMPoieae
How to: Deploy a Web Application Project Using One-Click Publish in Visual Studio Visual Studio 2012 RC is released - The Big Web Rollup
Multiversion Support
Visual Studio 2012 lets you work with projects that use different versions of the .NET Framework or different versions of Visual Studio. For more information, see Project Sharing Between Visual Studio 2010 and Visual Studio Express 2012 (Project Compatibility) in What's New in ASP.NET 4.5 and Visual Studio 2012 (ASP.NET website).
Working with ASP.NET Applications in Either Visual Studio 2010 SP1 or Visu al Studio 2012
You can open and work with Visual Studio 2010 SP1 projects in Visual Studio 2012 and vice-versa, without converting the project to a different format. (This feature is sometimes referred to as round-tripping.)
IIS Express
In Visual Studio 2012, IIS Express replaces the ASP.NET Development Server as the default web server for testing within Visual Studio. (In Visual Studio 2010 SP1, IIS Express was available as an option that you had to explicitly configure as the test web server.) IIS Express is a lightweight, self-contained version of IIS that has been optimized for developers. It has all the core capabilities of IIS as well as additional features designed to ease website development and includes the following: It does not run as a service or require administrator user rights in order to perform most tasks. IIS Express works well with ASP.NET and PHP applications. Multiple users of IIS Express can work independently on the same computer. For more information, see IIS Express Overview.
Additional Resources
The following links provide more information and resources that can help you learn about new features in ASP.NET 4.5 and Visual Studio 2012. Visual Studio 2012 RC is released - The Big Web Rollup (Scott Hanselman blog) What's New in Visual Studio 2012 . Describes new functionality in Visual Studio. What's New in the .NET Framework 4.5 . Describes new functionality in the .NET Framework for this release. Visual Studio 2012 Training Kit. Includes hands-on labs to help you understand how to take advantage of the variety of enhancements in the new version of Visual Studio and the .NET Framework 4.5. It shows you how to support and manage the entire application lifecycle and how to build Windows apps. ASP.NET 4.5 forum. A help forum specifically for the new release.