Presentation is loading. Please wait.

Presentation is loading. Please wait.

ASP.NET Overview Brian Hitney Developer Evangelist Microsoft Corporation

Similar presentations


Presentation on theme: "ASP.NET Overview Brian Hitney Developer Evangelist Microsoft Corporation"— Presentation transcript:

1 ASP.NET Overview Brian Hitney Developer Evangelist Microsoft Corporation bhitney@microsoft.com http://www.structuretoobig.com

2 Agenda ASP.NET Environment –Project Setup / Compilation model / Configuration –WebForms overview –User Controls/Server Controls –Authorization/Authentication providers –New features in ASP.NET Advanced Topics –HttpHandlers/HttpModules –Caching –Deployment Projects

3 Working with Projects – VS2003 VS2003: Single solution file. Project precompiled into a single DLL, ASPX markup pages deployed. Pros: –Compiles/debugs like other projects (WinForms, etc.) –Slightly more efficient. –Single file deployment + referenced DLLs + HTML. Cons: –Not easy to use in team environments. –Often leads to monolithic DLLs for large sites.

4 Working with Projects - VS2005 VS2005: Website Compilation Model – All files compiled on demand. Pros: –Works better in teams. –Easy to deploy/test incremental updates. Cons: –Can be difficult to upgrade from VS2003. –First hit incurs compilation overhead. –May mean more files to deploy. Web Application Projects – VS2005 add on to enable old style of building web applications.

5 Working with Projects - VS2008 VS2008: Both models supported out of the box. File -> New -> Project -> ASP.NET Web App File -> New -> Web Site Old style New style

6 WebForms in a Nutshell ASPX pages handled by a handler that facilitate the page lifecycle and events (such as Page_Load, PreRender, and control events). Uses ViewState to encoded state-specific information otherwise lost in the stateless nature of HTTP. Extensive controls library to abstract functionality. Buttons, textboxes, etc. Extensible. Challenges/Criticisms Can be difficult to manage many events with page lifecycle. –Do you load data in Init, Load, or event handlers? –How do you handle changes? –Developers still need to fully understand request/response nature of the web.

7 Server Controls Typically compiled into a DLL. Represents a small piece of functionality, like a textbox or button. Responsible for handling any special rendering requirements, raising events, etc. Properties Event Handlers

8 User Controls Collections of HTML and/or Server Controls for a broader purpose – such as a login dialog box. Typically part of a project and compiled with the project. Can expose properties. Part of the page lifecycle (OnInit, Page_Load, Prerender, etc.)

9 Master Pages Same look and feel to many pages; code in one spot.

10 Demo Server Controls Master Pages

11 Session Management InProc StateServer SqlServer

12 Authentication & Authorization Originally, IIS configured via Anon/Basic/Integrated and explicit file ACLs. ASP.NET introduced authorization/roles to resources via web.config setting. Works only for pages handled by ASP.NET ISAPI.

13 Authentication & Authorization Forms based authentication model –Provides an abstraction to maintaining user state –Done using an authorization ticket in an HTTP Cookie –You write the code to handle login, new users, etc., Forms Auth handles the client.

14 Authentication & Authorization ASP.NET 2.0 and Up: Membership and Role Providers –Supports SQL Server or Active Directory For SQL Server, handles password hashing, minimum password and strength, etc. –Easily pluggable into Forms auth (or custom auth) –Extensible – easy to author your own Membership provider by inheriting from the base class. –Source code available.

15 ASP.NET Diagnostics Advanced Tracing Health Monitoring Debugging

16 Tracing System.Diagnostics.Trace Trace.Write (various Overloads) 11 Sections of Request Information Logged Page Level Tracing –Page Directive –Allows you to designate on a page by page basis Application Level –Set in the Web.Config File –Page Level supersedes Web.Config settings

17 View Trace Data Multiple Pages at Once –Trace.axd –Great for troubleshooting an application without user’s knowledge –Served by a custom HttpHandler Output for the Specific Page –Appended to the Bottom of the normal output –Only shows data for specific request

18 Health Monitoring Enables You to Log Web Events –Failed Logins –Application Starts –Unhandled Exceptions Event Data Can Be Sent to Specific Stores –Event Log –Database –E-Mail Can Be Extended Through the Provider Model Configured in the Web.Config

19 Debugging Set Break Points on Specific Lines of Code with F9 Can Attach to a Running Process Remote Debugging Rich Set of DataTips Data Visualizers Rich JavaScript Debugging Experience Can Step Into SQL Server Queries

20 Overview of What’s New in VS2008 Javascript Intellisense/Debugging support Nested Master Pages Enhanced CSS Management Multi-targeting support. New data controls. MUCH improved designer.

21 Advanced Topics HttpHandlers and HttpModules Caching Web Deployment Projects Custom Configuration

22 HttpHandlers & HttpModules HttpModule #1 HttpModule #2 HttpModule #3 HttpHandler

23 HttpHandlers Every request in ASP.NET is processed by an HttpHandler –For example, ASPX pages are handled by the default ASPX Page HttpHandler. You can create your own httpHandlers to render content based on the request Handlers process the incoming request and generate the response output. Can be directly plugged in IIS7 (no more registering extensions to the ISAPI ASP.NET DLL).

24 HttpModules HttpModules are Similar to ISAPI Filters They are built using.NET The Integrate with the ASP.NET Request Pipeline –The Pipeline is over 20 events that fire during the processing of a request. Used to ‘Catch’ the Request and React as needed. –URL Rewriting –Security –Logging

25 Registering Handlers and Modules

26 Caching: Entire Page or User Controls Functionally equivalent… But! “Private” cache, clients unaware.

27 Caching Data/Objects Far more powerful –Can tie into SQL Server for data change notifications. Granular Easier to Control

28 Caching Client Side: Content Expiration Covered later in IIS section, however: –Useful for static content to decrease load times – fewer requests. –Tells clients to “bugger off” for specified time.** –Essentially a “public” cache.

29 Caching Client Side Etags and IF-MODIFIED-SINCE –Client requests resource each request. (Can be configured via Max-Age setting.) –If not changed, send 304 Not Modified response. –Still requires round trip, but saves bandwidth.

30 Demo Caching page level Caching data and objects

31 Web Deployment Projects Offers options for build/deployment tasks, including Precomplilation. Choose to compile all resources, or leave as-is.

32 Custom Configuration Sections Can add Custom Configuration Sections to Web.Config Inherits System.Configuration.ConfigurationSection Much more extensible than appSettings

33 Q&A and Lab


Download ppt "ASP.NET Overview Brian Hitney Developer Evangelist Microsoft Corporation"

Similar presentations


Ads by Google