Slide ASP.net 4.5

download Slide ASP.net 4.5

of 50

Transcript of Slide ASP.net 4.5

  • 7/30/2019 Slide ASP.net 4.5

    1/50

    Introduction to ASP.NET 4.5

    .NET Framework 4.5

    Email: [email protected]

    1

  • 7/30/2019 Slide ASP.net 4.5

    2/50

    Agenda

    The ASP.NET Core Runtime and Framework

    ASP.NET WebForms

    Strongly Typed Data Controls

    Model Binding

    HTML Encoded Data-Binding Expressions

    Unobtrusive Validation

    HTML5 Updates

    2

  • 7/30/2019 Slide ASP.net 4.5

    3/50

    Microsoft Web Platform

    WebPlatformI

    nstaller

    VisualS

    tudio2012Ajax Control Toolkit & jQuery

    ASP.NET 4.5 Web Forms

    ADO.NET Entity Framework

    SQL Server 2012

    IIS 8.0

    ASP.NET MVC 4

    This is the Web Platform for Professional Developers. It combines a

    rich and powerful web application framework with a supporting cast

    oftools, servers,technologies and applications for creating,

    designing, developing and delivering web solutions.

    3

  • 7/30/2019 Slide ASP.net 4.5

    4/50

    Visual Studio 2012

    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

    Unify all templates over Web Forms, MVC and Web Pages

    Build in mobile support

    4

  • 7/30/2019 Slide ASP.net 4.5

    5/50

    Visual Studio 2012HTML Editor Enhancements

    Automatic Event Handler generation

    Smart Tasks

    5

  • 7/30/2019 Slide ASP.net 4.5

    6/50

    Visual Studio 2012HTML Editor Enhancements

    Extract To User Control

    Highlight the a piece of code, right-click and select

    Extract to User Control in menu

    6

  • 7/30/2019 Slide ASP.net 4.5

    7/50

    Visual Studio 2012HTML Editor Enhancements

    HTML5 snippets

    7

  • 7/30/2019 Slide ASP.net 4.5

    8/50

    Visual Studio 2012HTML Editor Enhancements

    Element Matching

    When we rename an HTML element (change a div tag to be

    a header tag), the corresponding opening or closing tag also

    changes in real time.

    Smart indent

    8

  • 7/30/2019 Slide ASP.net 4.5

    9/50

    Visual Studio 2012HTML Editor Enhancements

    IntelliSense for code nuggets in attributes

    9

  • 7/30/2019 Slide ASP.net 4.5

    10/50

    Visual Studio 2012HTML 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

    10

    http://weblogs.asp.net/blogs/sreejukg/clip_image0054_58632A70.pnghttp://weblogs.asp.net/blogs/sreejukg/clip_image0024_3FE3B2ED.png
  • 7/30/2019 Slide ASP.net 4.5

    11/50

    Visual Studio 2012CSS Editor Enhancements

    CSS Editor Hierarchical Indentation

    CSS Editor Snippets

    CSS Color Picker

    Better Cross Browser support

    11

  • 7/30/2019 Slide ASP.net 4.5

    12/50

    Visual Studio 2012CSS Editor Enhancements

    CSS Editor Hierarchical Indentation

    12

  • 7/30/2019 Slide ASP.net 4.5

    13/50

    Visual Studio 2012CSS Editor Enhancements

    CSS Color Picker

    IntelliSense for color-related attributes consisted of a drop-

    down list of named color values

    13

  • 7/30/2019 Slide ASP.net 4.5

    14/50

    Visual Studio 2012CSS Editor Enhancements

    CSS Editor Snippets

    Snippets in the CSS editor make it easier and faster to create

    cross-browser styles

    14

  • 7/30/2019 Slide ASP.net 4.5

    15/50

    Visual Studio 2012Javascript 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

    15

  • 7/30/2019 Slide ASP.net 4.5

    16/50

    Visual Studio 2012Page Inspector

    Page Inspector is a tool that renders a web page

    (HTML, Web Forms, ASP.NET MVC, or Web Pages) in

    the Visual Studio IDE and lets you examine both the

    source code and the resulting output

    Page Inspector lets you determine which server-side

    code has produced the HTML markup that is rendered

    to the browser

    16

  • 7/30/2019 Slide ASP.net 4.5

    17/50

    Visual Studio 2012Page Inspector

    17

  • 7/30/2019 Slide ASP.net 4.5

    18/50

    ASP.NET Runtime

    Script Libraries as NuGet Packages

    Web Optimization

    Async

    Universal Providers

    Request Validation

    Data Annotations

    Miscellaneous

    Support for WebSockets Protocol

    18

  • 7/30/2019 Slide ASP.net 4.5

    19/50

    ASP.NET Runtime

    Script Libraries as NuGet Packages

    Today

    Project templates ship with script libraries

    jQuery

    jQuery UILibraries are updated and template is out of date

    Where do I go to get latest version?

    Visual Studio 11Script libraries are included as NuGet packagesUpdated automatically via NuGet Package

    Manager

    19

  • 7/30/2019 Slide ASP.net 4.5

    20/50

    ASP.NET Runtime

    Web Optimization

    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

    20

  • 7/30/2019 Slide ASP.net 4.5

    21/50

    ASP.NET Runtime

    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

    21

  • 7/30/2019 Slide ASP.net 4.5

    22/50

    ASP.NET Runtime

    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 comebefore any other CSS file

    The default bundle is called css

    Include the following script link to load the default

    bundle in your page

    22

  • 7/30/2019 Slide ASP.net 4.5

    23/50

    ASP.NET Runtime

    Bundling And Minification

    You can register your own bundles in Global.asax

    for custom processing

    Referencing your custom bundle

    23

  • 7/30/2019 Slide ASP.net 4.5

    24/50

    ASP.NET Runtime

    Async

    Support for the new Await keyword in ASP.NET

    Ensure that the Task return value from await

    can be wired up to an IAsyncResult

    Supported:

    Handlers

    HttpModule

    MVC 4

    24

  • 7/30/2019 Slide ASP.net 4.5

    25/50

    ASP.NET Runtime

    Asynchronous HttpModule

    Suppose to perform asynchronous work within a method

    that returns a Task object

    25

  • 7/30/2019 Slide ASP.net 4.5

    26/50

    ASP.NET Runtime

    The traditional approach to writing asynchronous handlers in

    ASP.NET is to implement the IHttpAsyncHandler interface

    26

    Asynchronous HttpHandler

  • 7/30/2019 Slide ASP.net 4.5

    27/50

    ASP.NET Runtime

    Universal Providers

    Membership, Profile, Role, Session providers only work

    against certain version of SQL Server

    Universal Providers are built on top of Entity Framework

    and work against any database supported by Entity

    Framework

    SQL Server, Azure SQL, SQL Compact and many more

    Released as a NuGet soon and included in v.Next

    27

  • 7/30/2019 Slide ASP.net 4.5

    28/50

    ASP.NET Runtime

    Request Validation

    History:

    .NET 2.0

    disabled validation

    for the entire page

    .NET 4

    Request validation was moved earlier in the pipeline

    allowing protection of Modules. To turn it off for a

    page you had to revert to the 2.0 mode losing the

    new protection

    Web Pages 1 / MVC 3

    Provide new unvalidated collections of form, query

    string, cookie collections allowing granular access

    28

  • 7/30/2019 Slide ASP.net 4.5

    29/50

    ASP.NET Runtime

    Request Validation

    ASP.NET 4.5 enhancementsDisable 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[]

    In web.config

    Set ValidateRequestMode on control to Disabled

    To access the un-validated request manually

    i.e.: Request.Unvalidated.Form[]

    Be careful with this

    29

  • 7/30/2019 Slide ASP.net 4.5

    30/50

    ASP.NET 4.5

    Compare

    CreditCard

    EmailAddress

    FileExtension

    Phone

    Url

    DataTypeCreditCard

    PostalCode

    Upload

    Data AnnotationsStartup performance &

    working set improvements

    Incremental file upload

    Allow uploads > 2GB

    Anti-XSS encoders

    ASP.NET admin modules

    And more

    Miscellaneous

    30

  • 7/30/2019 Slide ASP.net 4.5

    31/50

    ASP.NET 4.5

    SP1:

    vNext:

    HTML 5

    Text

    Multiline

    PasswordColor

    Date

    DateTime

    DateTimeLocal

    Email

    MonthNumber

    Range

    Search

    Phone

    Time

    UrlWeek

    31

  • 7/30/2019 Slide ASP.net 4.5

    32/50

    ASP.NET 4.5

    Script libraries included as NuGet packages

    Updatable

    HTML 5

    Dynamically updates to device size

    Modernizer library

    Templates use HTML 5 that gracefully falls back

    on older browsers

    Project Templates32

  • 7/30/2019 Slide ASP.net 4.5

    33/50

    ASP.NET 4.5

    Strongly Typed Data Controls

    Strongly Typed Data Expressions

    Intellisense

    Compile time not run time errors

    33

  • 7/30/2019 Slide ASP.net 4.5

    34/50

    ASP.NET 4.5

    Model Binding

    Model binding extends data binding in ASP.NET Web

    Forms controls to work with code-focused data access

    It incorporates concepts from the ObjectDataSource

    control and from model binding in ASP.NET MVC

    Selecting data

    Value providers

    Filtering by values from a control

    34

  • 7/30/2019 Slide ASP.net 4.5

    35/50

    ASP.NET 4.5

    Model Binding Selecting Data

    To configure a data control to use model binding to

    select data,we set the control's SelectMethod property

    to the name of a method in the page's code.

    The data control calls the method at the appropriate

    time in the page life cycle and automatically binds the

    returned data.

    There's no need to explicitly call the DataBind method.

    35

  • 7/30/2019 Slide ASP.net 4.5

    36/50

    ASP.NET 4.5

    Model Binding Selecting Data36

  • 7/30/2019 Slide ASP.net 4.5

    37/50

    ASP.NET 4.5

    Model Binding Value Providers

    By default, the parameter name is used as the key to

    find a value in the value provider collection.

    for example :

    37

  • 7/30/2019 Slide ASP.net 4.5

    38/50

    ASP.NET 4.5

    Model Binding Filter By Values38

  • 7/30/2019 Slide ASP.net 4.5

    39/50

    ASP.NET 4.5

    Model Binding Filter By Values39

  • 7/30/2019 Slide ASP.net 4.5

    40/50

    ASP.NET 4.5

    HTML encoded Data-Binding Expressions40

    We can now HTML-encode the result of data-binding

    expressions. Add a colon (:) to the end of the

  • 7/30/2019 Slide ASP.net 4.5

    41/50

    ASP.NET 4.5

    Ubobtrusive Javascript

    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

    41

  • 7/30/2019 Slide ASP.net 4.5

    42/50

    ASP.NET 4.5

    Ubobtrusive Javascript

    Cleaner page markup

    Supports pluggable client validation libraries

    jQueryValidate is default implementation

    Markup:

    42

  • 7/30/2019 Slide ASP.net 4.5

    43/50

    ASP.NET 4.5

    Ubobtrusive Javascript

    43

  • 7/30/2019 Slide ASP.net 4.5

    44/50

    ASP.NET 4.5

    Web Socket Protocol44

    WebSockets protocol is a standards-based network protocol

    that defines how to establish secure, real-time bidirectional

    communications between a client and a server over HTTP.

    The WebSockets protocol is supported by any client (not just

    browsers), and mobile operating systems.

    WebSockets protocol makes it much easier to create long-

    running data transfers between a client and a server

  • 7/30/2019 Slide ASP.net 4.5

    45/50

    ASP.NET 4.5

    Web Socket Protocol45

    ASP.NET 4.5 and IIS 8 include low-level WebSockets support,

    enabling ASP.NET developers to use managed APIs for

    asynchronously reading and writing both string and binary

    data on a WebSockets object.

  • 7/30/2019 Slide ASP.net 4.5

    46/50

    ASP.NET 4.5

    Web Socket Protocol46

  • 7/30/2019 Slide ASP.net 4.5

    47/50

    ASP.NET MVC 4

    Overview

    Release Details

    Supports Visual Studio 2010

    Ship in box with Visual Studio 11

    Feature Overview

    Mobile Support and Mobile Template

    Single Page Applications

    WCF Web API

  • 7/30/2019 Slide ASP.net 4.5

    48/50

    ASP.NET MVC 4 & WCF WEB API

    ASP.NET MVC

    ASP.NET Routing

    Model bindingValidation

    Filters

    Link generation

    Testability

    Dependency resolver

    WCF Web API

    Modern HTTP programming

    modelTask-based async

    Content negotiation

    Server-side query composition

    Test client, help page

    Self-host

    W b Li k Addi i l R

  • 7/30/2019 Slide ASP.net 4.5

    49/50

    Web Links to Additional Resources

    http://www.nuget.org

    http://aka.ms/mbl-tech

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

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

    http://www.asp.net/vnext

    49

  • 7/30/2019 Slide ASP.net 4.5

    50/50

    ASP.NET 4.5

    Thank You

    Q & A

    50