* | microsoft norge asp.net -

18
7. februar 2022 | Microsoft Norge

Upload: sampetruda

Post on 18-Dec-2014

1.349 views

Category:

Documents


4 download

DESCRIPTION

 

TRANSCRIPT

Page 1: * | Microsoft Norge ASP.NET -

10. april 2023 | Microsoft Norge

Page 2: * | Microsoft Norge ASP.NET -

ASP.NET -> AJAX

Jan Blomquist, MVP, MCT

www.traincert.net

www.cbtoffice.no

Page 3: * | Microsoft Norge ASP.NET -

Agenda

Page 4: * | Microsoft Norge ASP.NET -

A Better Web User Experience

• Better user experiences make better applications

• Higher user traffic and retention

• Greater differentiation

• Higher user productivity

Page 5: * | Microsoft Norge ASP.NET -

ASP.NET AJAX

• Fully cross-platform, cross-browser• High productivity AJAX application development• Client script framework for easy script creation and reuse• End-to-end programming model for browser and server• Rich tool experience integrated with Visual Studio• Free, fully supported runtime and tools

Page 6: * | Microsoft Norge ASP.NET -

What is ASP.NET Ajax?

An end-to-end framework for building rich, interactive Web experiences and browser-based applications

ASP.NET 2.0 Ajax Extensions– Server controls that very simply enable AJAX in any ASP.NET application

Microsoft Ajax Library– Client script framework that works cross-browser, and back-end server

ASP.NET Ajax Control Toolkit– Rich set of server controls and client script functionality

– Community development model

Key Goals– Simple, Yet Powerful

– .NET-like feel to script framework

– Reduce the need for scripting by every developer in mainline scenarios

Page 7: * | Microsoft Norge ASP.NET -

Why AJAX?Looking Beyond the Hype

Improving site/application characteristics

– Performance: smaller updates, requests/responses

– End-user perception: smooth interactions; no hard breaks

– Usability: visual notifications, new gestures, widgets

– Improve visual appeal: animations

– Provide additional functionality: auto-updates, background work, etc.

Why Ajax-ify?

– Not just because of the hype!

– Differentiated experiences are key to new successes with customers and meeting rising expectations

Page 8: * | Microsoft Norge ASP.NET -

AJAX Video Viewer

Page 9: * | Microsoft Norge ASP.NET -

Which Scenarios does ASP.NET Ajax Address?

Enriching ASP.NET applications– No scripting required– Declaratively enable post-back-less updates and partial rendering

of portions of pages– Ajax-enabled controls or extenders for scenarios beyond page

updates

Using Web services from client script– Some amount of scripting– Method-based abstraction over XMLHttp for .asmx/.svc services– Support for JSON, RESTful services

Building reusable Ajax Components– Requires scripting with pay for play model– Script framework provides more robust, and productive

development model– Extensibility support on both server and client

Page 10: * | Microsoft Norge ASP.NET -

Demo NotesAjax via UpdatePanels

Simple mechanism for basic “Ajax-y” feelDeclarative model to specify logical parts of your page

– No need for scriptingEach part can update incrementally and independently without a postbackUpdates happen without regular post-backs

– Browser does not refresh entire pageRequests are processed as regular post-backs

– Server-side logic and model is preserved– Framework code determines the parts of the page that should be re-rendered

Page 11: * | Microsoft Norge ASP.NET -

UpdatePanel Under the Covers

Client script suppresses normal form submit– Simulates post-back request via XMLHttpRequest

• All form fields, including view state– One extra header to request partial rendering

Server processes a regular post-back– Same page lifecycle, post-back processing– UpdatePanels determine if they need to be updated

• Always vs. Conditional modes– ScriptManager control takes over rendering

• Only render content of UpdatePanels needing update• Response includes updated view state

Client script processes “delta” response– Updates rendering with new markup– Update hidden fields etc.

Page 12: * | Microsoft Norge ASP.NET -

Demo NotesUpdatePanel Performance Guidelines

Post-back requests are still full post-back requests– Incremental approach; preserves existing app models– One request at a time– Smaller responses, but requests are same– Think about which user actions should cause post-backs

Optimize what needs to be updated and when– Set UpdatePanels into Conditional Mode– Use Triggers, or Update() method to control

Page 13: * | Microsoft Norge ASP.NET -

Demo NotesAccessing Web Services

Applications can expose data and operations as “Web services”– SOAP (.asmx, .svc), RESTful (.ashx) models

Support for JSON-based message format and object serializationXMLHttp abstractions on the clientScript proxies for .asmx and .svc services

– Enables calling methods which in turn perform web requests, and marshalling of parameters and return values

Page 14: * | Microsoft Norge ASP.NET -

Demo NotesPartial Rendering vs. Web Services

Two models for updating UI incrementallyPartial rendering – when you need page state, controls etc. in server-side logic

– Pros: Simple to incorporate, use control properties, page state– Cons: Full-postback, one request at a time

Web Services – when your server-side logic is stateless– Pros: Light-weight, multiple requests in parallel– Cons: Need to write a bit of client script to extract data from UI, and package as

parameters to call web serviceBoth are useful toolsASP.NET Ajax provides both models

– UpdatePanel– .asmx/.svc programming model; client script proxies provide higher level of

abstraction over XMLHttpRequest

Page 15: * | Microsoft Norge ASP.NET -

Demo NotesScripting

Improvements to raw scripting

– OOP simulation: namespaces, classes, interfaces, enums, delegates

– BCL extensions: Array, String, etc.

– BCL additions: StringBuilder, Debug, etc.

UI Framework

– Behaviors and Controls on the client to attach functionality to DOM elements

– Unobtrusive script model keeps content and behavior separate

Page 16: * | Microsoft Norge ASP.NET -

Resources

ASP.NET AJAX Website– Downloads, videos, tutorials, and forums

– http://ajax.asp.net

Page 17: * | Microsoft Norge ASP.NET -

ASP.NET AJAX Release RoadmapBeyond

New features previewed in ASP.NET AJAX Futures CTP

Visual Studio and .NET Framework “Orcas”

– ASP.NET AJAX will be rolled into .NET Framework

– Better tools for script authoring and debugging

– Better designer support for ASP.NET AJAX server controls

– Richer server controls

– Fully localized versions of runtime, tools, and documentation(V1.0 already supports localized applications)

Page 18: * | Microsoft Norge ASP.NET -

10. april 2023 | Microsoft Norge

Til slutt…

Hjelp oss å bli bedre– Fyll ut evalueringen som kommer på e-post– Gi direkte råd til Microsoft-representanter

Hold deg oppdatert– www.microsoft.no/informasjon – Besøk oss på www.microsoft.no/msdn eller www.microsoft.no/technet