Upgrade to Pro — share decks privately, control downloads, hide ads and more …

.NET Framework update

.NET Framework update

Andy Cheng

January 24, 2013
Tweet

More Decks by Andy Cheng

Other Decks in Programming

Transcript

  1. .NET Framework 4.5 • What’s new in .NET 4.5? •

    http://msdn.microsoft.com/en-us/library/ms171868.aspx
  2. .NET Framework 4.5 • Side By Side release – Like

    v1.1 and v2.0. There releases are completely independent of each other • Enhancements – Like v3.0 and 3.5 • .NET 4 is a Side By Side upgrade. Which means it can exist independent of v1.1 and v2.0. • .NET 4.5 is an enhancement, but unlike 3.0 or 3.5 it will not be separated out. It is an in place upgrade. • Which means once you install .NET 4.5 the v4.0 folder will be updated to contain all the .NET 4.5 files.
  3. The .NET Framework Components Win32 Message Queuing COM+ (Transactions, Partitions,

    Object Pooling) IIS WMI Common Language Runtime .NET Framework Class Library ADO.NET and XML XML Web Services User Interface Visual Basic C++ C# ASP.NET Perl Python …
  4. The Common Language Runtime(CLR) • One runtime for all .

    NET-Based Languages • Manages threads and memory • Garbage collection • Enforces code security • Eliminates DLL versioning problems • Multiple versions of a DLL can run simultaneously • Applications can specify a version of a DLL to use
  5. Multiple Language Support • The .NET Framework is designed to

    support many languages • More than 20 languages currently supported • Microsoft provides Visual Basic .NET, C#, Visual J# .NET, and JScript .NET • Benefits of multiple-language support • Code modules are reusable • Class Library access is the same for all languages • The right language is used for the right task • Performance is roughly equal between all languages
  6. ASP Web Application Architecture Presentation Tier Business Logic Tier Data

    Tier UI Pages (.htm) Graphic Files COM Objects Data Source ADO COM+ Services ASP Page (.asp)
  7. ASP.NET Web Application Architecture Presentation Tier Business Logic Tier Data

    Tier Graphic Files UI Pages (.htm) XML Web Services (.asmx) User Controls (.ascx) Code-Behind File (.aspx.vb or .aspx.cs) Proxy ADO.NET .NET Objects Data Source COM+ Services COM Objects RCW Web Form (.aspx)
  8. ASP.NET Coding Changes • Page directives • Language attribute must

    be in set the @Page directive • Structural changes • All functions and variables must be declared within a <script> block • Only one language per page • Render Functions are no longer supported; use Response.Write • Design-Time controls are no longer supported • Replaced with Web controls
  9. ASP.NET Runtime Compilation and Execution Native code C# Visual Basic

    .NET Which language? Visual Basic .NET compiler C# compiler MSIL JIT compiler default.aspx Common Language Runtime
  10. How to Implement Code • Three methods for adding code:

    • Put code in the same file as content (mixed) • Put code in a separate <SCRIPT> section of the content file (inline code) • Put code in a separate file (code-behind pages) • Code-behind pages are the Visual Studio .NET default Form1.aspx Form1.aspx Form1.aspx.vb or Form1.aspx.cs <tags> <tags> code code Separate files Single file Code-Behind Page
  11. Understanding How Code-Behind Pages Work • Create separate files for

    user interface and interface logic • Use @ Page directive to link the two files Page1.aspx <% @ Page Language="C#" Inherits="Project.WebForm1" Codebehind="Page1.aspx.cs" Src = "Page1.aspx.cs" %> Page1.aspx.cs namespace Project { public class WebForm1 : System.Web.UI.Page { } }
  12. Client-Side Event Procedures • Typically used only with HTML controls

    • Interpreted by the browser and run on the client • Do not have access to server resources • Use <SCRIPT language="language"> Internet .HTM Pages
  13. Server-Side Event Procedures • Used with both Web and HTML

    server controls • Code is compiled and run on the server • Have access to server resources • Use <SCRIPT language="language" runat="server"> Internet .ASPX Pages
  14. Creating Event Procedures • Visual Studio .NET declares variables and

    creates an event procedure template in the code-behind page protected System.Web.UI.WebControls.Button btn; private void InitializeComponent() { this.btn.Click += new System.EventHandler(this.btn_Click); } private void btn_Click(object sender, System.EventArgs e) { }
  15. Events in the Web Page Generation Process • Events in

    the Web page generation process • ASP.NET server control events are handled when the Web page is posted back to the server • Use the Page.IsPostback property to determine if the Web page is being generated for the first time Page_Unload Page_Init Page_Load Server control events private void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { // executes only on initial page load } //this code executes on every request
  16. Postback • Postback is the process by which the browser

    posts information back to itself. • That is, posts information back to the server by requesting the same page. • Postback in ASP.NET only occurs within web forms (i.e., within a form element with runat=server), and only server controls post back information to the server. • Each cycle in which information is displayed then posted back to the server, and then redisplayed again, is sometimes also called a round trip.
  17. View State • View state is one of the most

    important features of ASP.NET. • It is a specially encoded string that is used to retain page and form information between requests and is sent to the browser within a hidden HTML <input> element. • All page elements not posted back via the standard HTTP POST mechanism are stored within this string. <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJODExMDE5NzY5D2QWAgIDD2QWAgIBDw8WAh4EVGV4dAUKMDgvMDE vMjAwNmRkZDZPhFHJER4chf3nmlgfL+uq4W58" />
  18. Overall View Of IIS in Request Processing Svchost.exe World Wide

    Web Publishing Service (WWW service) Windows Process Activation Service (WAS) HTTP.SYS ApplicationHost.Config
  19. Overall View Of IIS in Request Processing Svchost.exe World Wide

    Web Publishing Service (WWW service) Windows Process Activation Service (WAS) HTTP.SYS ApplicationHost.Config Worker Process (w3wp.exe)
  20. HTTP Application  Created By HTTPApplicationFacotry class  It’s create

    pool of HTTPApplication Object W3wp.exe Web Server Core Modules