ASPNET for PHP Developers


Published on

ASPNET for PHP Developers

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • KEY MESSAGE: SLIDE BUILDS: None SLIDE SCRIPT: Hello and Welcome to this MSDN session on {insert session title}. My name is {insert name} [Do not use the term FIELDCONTENT] SLIDE TRANSITION: ADDITIONAL INFORMATION FOR PRESENTER:
  • ASPNET for PHP Developers

    1. 1. ASP.NET for PHP Developers Joe Stagner ( [email_address] ) Developer Technologist Microsoft Corporation
    2. 2. Session Prerequisites <ul><li>Knowledge of PHP </li></ul><ul><li>Some familiarity with ASP.NET </li></ul><ul><li>Some familiarity with C# </li></ul>Level 200
    3. 3. Demonstrations <ul><li>Demo 1 – ASP.NET Event Model </li></ul><ul><li>Demo 2 – Validation, </li></ul><ul><li>Session State & Error Handling </li></ul><ul><li>Demo 3 – Database Access </li></ul><ul><li>Demo 4 – Authentication </li></ul><ul><li>Demo 5 – XML in ASP.NET </li></ul>
    4. 4. Agenda <ul><li>Architecture Comparison </li></ul><ul><li>ASP.NET and PHP Functionality </li></ul><ul><li>Migration Considerations </li></ul>
    5. 5. Architecture Comparison <ul><li>Microsoft .NET with ASP.NET </li></ul>PHP pages running on most major web servers Presentation Business Logic Data MySQL PHP and Apache CLR C# Assembly ADO.NET. Can still use COM+ Components. MySQL common, but support for most databases PHP Platform SQL Server 2000 Stored Procedures OpenXML. Web Forms Server Controls Code-Behind. ASP.NET IIS
    6. 6. Architecture Comparison <ul><li>Analogous Functionality </li></ul><ul><li>Lower Architectural Level </li></ul><ul><ul><li>Platform Independent Processor/Engine </li></ul></ul><ul><ul><li>A Series of Technologies </li></ul></ul>
    7. 7. <ul><li>Both Support OOP </li></ul><ul><li>PHP (4.x) </li></ul><ul><ul><li>Only Supports Partial Encapsulation </li></ul></ul><ul><ul><li>No Overloading </li></ul></ul><ul><ul><li>No abstraction </li></ul></ul><ul><li>ASP.NET </li></ul><ul><ul><li>Offers Private, Public, Protected accessibility </li></ul></ul><ul><ul><li>Supports overloading and polymorphism </li></ul></ul><ul><li>PHP (5) </li></ul><ul><ul><li>Good OOP Support </li></ul></ul>Architecture Comparison
    8. 8. <ul><li>Compilation </li></ul><ul><ul><li>PHP </li></ul></ul><ul><ul><ul><li>Compiled to Zend Opcodes when requested </li></ul></ul></ul><ul><ul><ul><li>Zend Engine generates and serves HTML </li></ul></ul></ul><ul><ul><li>ASP.NET </li></ul></ul><ul><ul><ul><li>Compiled to MSIL (Microsoft Intermediate Language) on the first request </li></ul></ul></ul><ul><ul><ul><li>MISL processed by the CLR (Common Runtime Language) to machine code </li></ul></ul></ul><ul><ul><ul><li>Subsequent requests use that same machine code (no recompilation) </li></ul></ul></ul>Architecture Comparison
    9. 9. <ul><li>Feature Comparison </li></ul><ul><ul><li>Coding language </li></ul></ul><ul><ul><li>Component Model </li></ul></ul><ul><ul><li>Type System </li></ul></ul><ul><ul><li>Output Caching </li></ul></ul><ul><ul><li>Database Access </li></ul></ul><ul><ul><li>Database Output </li></ul></ul><ul><ul><li>External Packages </li></ul></ul><ul><ul><li>XML </li></ul></ul>Architecture Comparison
    10. 10. <ul><li>Feature Comparison (cont.) </li></ul><ul><ul><li>Eventing </li></ul></ul><ul><ul><li>XML Web Services </li></ul></ul><ul><ul><li>Session State </li></ul></ul><ul><ul><li>Regular Expressions </li></ul></ul><ul><ul><li>Debugging </li></ul></ul><ul><ul><li>Error Handling </li></ul></ul><ul><ul><li>IDE </li></ul></ul>Architecture Comparison
    11. 11. <ul><li>PHP </li></ul><ul><ul><li>Perl style syntax </li></ul></ul><ul><ul><li>Loosely typed variable declaration </li></ul></ul><ul><ul><li>Code Rendering Blocks <?php … ?> </li></ul></ul><ul><li>ASP.NET </li></ul><ul><ul><li>VB or C# syntax </li></ul></ul><ul><ul><li>Strongly typed variable declaration </li></ul></ul><ul><ul><li>Code Rendering Blocks <% … %> </li></ul></ul><ul><ul><li>Code Behind </li></ul></ul>Comparing Syntax and Common Tasks
    12. 12. <ul><li>HTML Server Controls </li></ul><ul><ul><li>May contain properties, methods, and events </li></ul></ul><ul><ul><li>Tag identifies the control to create </li></ul></ul><ul><ul><li>Must contain the ‘runat=server’ attribute </li></ul></ul><ul><li>Web Server Controls </li></ul><ul><ul><li>Provides browser specific HTML </li></ul></ul><ul><ul><li>Provides an abstract way of creating controls that may be rendered in a browser specific way. </li></ul></ul>Server Controls
    13. 13. <ul><li>PHP </li></ul><ul><ul><li>Handles event through the PostBack mechanism </li></ul></ul><ul><ul><li>May manually detect events with client side script. </li></ul></ul><ul><li>ASP.NET </li></ul><ul><ul><li>Server Controls invoke server side events. </li></ul></ul><ul><ul><li>Event handling happens in through ASP.NET on the server. </li></ul></ul>Event Handling
    14. 14. Demo Programming the Event Model
    15. 15. <ul><li>Session State </li></ul><ul><li>ViewState </li></ul><ul><li>Cookies </li></ul>Page State
    16. 16. Validation <ul><li>Validation Controls </li></ul><ul><ul><li>RequiredFieldValidator </li></ul></ul><ul><ul><li>RegularExpressionValidator </li></ul></ul><ul><ul><li>CustomValidator </li></ul></ul><ul><li>Client-side Validation </li></ul><ul><li>Displaying Validation Errors </li></ul><ul><li>ControlToValidate </li></ul>
    17. 17. Session State <ul><li>Session State Store Modes </li></ul><ul><ul><li>In-Process Mode (InProc) </li></ul></ul><ul><ul><li>State Server Mode (StateServer) </li></ul></ul><ul><ul><li>SQL Server Mode (SQLServer) </li></ul></ul><ul><li>ASP.NET’s cookieless feature (cookieless=“true”) </li></ul>
    18. 18. Configuration <ul><li>Hierarchy of .config Files </li></ul><ul><ul><li>machine.config </li></ul></ul><ul><ul><li>Web.config </li></ul></ul><ul><li>XML-based </li></ul><ul><li>Live changes </li></ul><ul><li>Extensible </li></ul>
    19. 19. Error handling <ul><li>Try – Catch – Finally </li></ul><ul><li>Customizing error pages </li></ul><configuration> <system.web> <customErrors mode=&quot;RemoteOnly&quot; defaultRedirect=“/CustomError.htm&quot;/> <error statusCode=&quot;500&quot; redirect=&quot;/error/callsupport.htm&quot;/> <error statusCode=&quot;404&quot; redirect=&quot;/error/notfound.aspx&quot;/> </system.web> </configuration> <ul><li>Application-wide with Global.aspx </li></ul>private void Application_Error(object sender,System.EventArgs e) { // use Request.Url.ToString() to get URL // use Server.GetLastError().ToString() for a Stack Trace // write the error message to the NT Event Log }
    20. 20. Demo Validation, Session State and Error Handling
    21. 21. Data Access <ul><li>ADO.NET </li></ul><ul><li>Dataset object </li></ul><ul><li>Databinding </li></ul>
    22. 22. Demo Database Access
    23. 23. Authentication Types <ul><li>ACL </li></ul><ul><li>URL </li></ul><ul><li>Authentication Element </li></ul><ul><ul><li>None </li></ul></ul><ul><ul><li>Windows </li></ul></ul><ul><ul><li>Forms </li></ul></ul><ul><ul><li>Passport </li></ul></ul>
    24. 24. Demo Authentication
    25. 25. Catalog browsing <ul><li>Middle tier </li></ul><ul><ul><li>Call: SqlConnection, SqlDataAdapter and SqlCommand </li></ul></ul><ul><ul><li>Return: DataSet or SqlDataReader </li></ul></ul><ul><li>Presentational tier </li></ul><ul><ul><li>DataBind query results to data controls </li></ul></ul><ul><ul><li>Repeater and DataList objects </li></ul></ul><ul><ul><li>ItemTemplate to set presentation </li></ul></ul>
    26. 26. XML <ul><li>PHP </li></ul><ul><ul><li>Uses a SAX parser </li></ul></ul><ul><ul><li>No native DTD support </li></ul></ul><ul><ul><li>Numerous third party packages available </li></ul></ul><ul><li>ASP.NET </li></ul><ul><ul><li>Supports DOM parsing </li></ul></ul><ul><ul><li>.NET provides support for all W3C recommendations </li></ul></ul><ul><ul><li>Extensive support for UDDI, WDSL, and SOAP </li></ul></ul>
    27. 27. Demo Working with XML & XML Web Services
    28. 28. Integreted IDE <ul><li>Debugging </li></ul><ul><ul><li>Visual Studio .NET provides excellent ASP.NET debugging tools. </li></ul></ul><ul><ul><li>Allows for breakpoint setting in the events </li></ul></ul><ul><ul><li>One debugging session crosses all three logical tiers (presentation/script, component, and sql) </li></ul></ul>
    29. 29. Deployment <ul><li>XCOPY / Drag ‘n Drop </li></ul><ul><li>Windows Installer </li></ul>
    30. 30. ASP.NET Can – PHP Can’t <ul><li>Component Creation </li></ul><ul><li>Calling binary .DLLs </li></ul><ul><li>Simplifying Interoperability </li></ul><ul><li>Remote Instancing </li></ul><ul><li>Application Multithreading </li></ul><ul><li>Asynchronous Dependencies </li></ul><ul><li>Multi Phase Transactions </li></ul><ul><li>Aggregating Multi-Interfaced Objects </li></ul><ul><li>Type Encapsulation & Abstraction </li></ul><ul><li>Object Scope Promotion </li></ul><ul><li>Static Instance Access </li></ul>
    31. 31. Migration Considerations <ul><li>Business logic </li></ul><ul><ul><li>Separate business logic from presentation code </li></ul></ul><ul><ul><li>Create .NET components </li></ul></ul><ul><li>Presentation </li></ul><ul><ul><li>Generate Pages </li></ul></ul><ul><ul><li>Use Server Controls </li></ul></ul><ul><ul><li>.aspx and .cs files </li></ul></ul><ul><ul><li>Presentation logic calls .NET components </li></ul></ul>
    32. 32. Migration Considerations <ul><li>Output caching </li></ul><ul><ul><li>Cache pages </li></ul></ul><ul><ul><li>Reduce load on database, web server </li></ul></ul><ul><ul><li>Increased performance </li></ul></ul><ul><li>Fragment Caching </li></ul>
    33. 33. Migration Considerations <ul><li>Data caching </li></ul><ul><ul><li>Expiration </li></ul></ul><ul><ul><li>Scavenging </li></ul></ul><ul><ul><li>File and Key Dependencies </li></ul></ul>
    34. 34. For More Information… <ul><li>MSDN Web site at </li></ul><ul><ul><li> </li></ul></ul><ul><li>Other MS web sites </li></ul><ul><ul><li> </li></ul></ul>
    35. 35. 3 rd Party Applications <ul><li>A broad range of applications on ASP.NET </li></ul><ul><li>Commercial and Non-Commercial licensing </li></ul><ul><li>Fully customizable </li></ul><ul><li>Initial applications </li></ul><ul><ul><li>DotNetNuke (portal builder) </li></ul></ul><ul><ul><li>Telligent Community Server </li></ul></ul><ul><ul><li>Forums, Blogs, Gallery </li></ul></ul>
    36. 36. MSDN Essential Resources for Developers Training & Events MSDN Webcasts, MSDN Online Seminars, Tech-Ed, PDC, Developer Days Subscription Services Online Information Membership Programs Print Publications Library, OS, Professional, Enterprise, Universal Delivered via CD-ROM, DVD, Web MSDN Online, MSDN Flash, How-To Resources, Download Center MSDN User Groups MSDN Magazine MSDN News
    37. 37. How-To Resources Simple, Step-By-Step Procedures <ul><li>Embedded Development How-To Resources </li></ul><ul><li>General How-To Resources </li></ul><ul><li>Integration How-To Resources </li></ul><ul><li>JScript .NET How-To Resources </li></ul><ul><li>.NET Development How-To Resources </li></ul><ul><li>Office Development Resources </li></ul><ul><li>Security How-To Resources </li></ul><ul><li>Visual Basic ® .NET How-To Resources </li></ul><ul><li>Visual C# ™ .NET How-To Resources </li></ul><ul><li>Visual Studio ® .NET How-To Resources </li></ul><ul><li>Web Development How-To Resources (ASP, IIS, XML) </li></ul><ul><li>Web Services How-To Resources </li></ul><ul><li>Windows Development How-To Resources </li></ul><ul><li> </li></ul>
    38. 38. MSDN Webcasts Interactive, Live Online Event <ul><li>Interactive, Synchronous, Live Online Event </li></ul><ul><li>Discuss the Hottest Topics from Microsoft </li></ul><ul><li>Open and Free For The General Public </li></ul><ul><li>Takes Place Every Tuesdays </li></ul><ul><li> </li></ul>
    39. 39. MSDN Subscriptions THE way to get Visual Studio .NET Visual Studio .NET MSDN Subscriptions NEW <ul><li>Professional </li></ul><ul><li>Tools to build applications and XML Web services for Windows and the Web </li></ul>MSDN Professional $1199 new $899 renewal/upgrade MSDN Enterprise $2199 new $1599 renewal/upgrade MSDN Universal $2799 new $2299 renewal/upgrade <ul><li>Enterprise Developer </li></ul><ul><li>Enterprise lifecycle tools </li></ul><ul><li>Team development support </li></ul><ul><li>Core .NET Enterprise Servers </li></ul><ul><li>Enterprise Architect </li></ul><ul><li>Software and data modeling </li></ul><ul><li>Enterprise templates </li></ul><ul><li>Architectural guidance </li></ul>
    40. 40. Where Can I Get MSDN? <ul><li>Visit MSDN Online at </li></ul><ul><li>Register for the MSDN Flash Email Newsletter at </li></ul><ul><ul><li> </li></ul></ul><ul><li>Become an MSDN CD Subscriber at </li></ul><ul><li>MSDN online seminars </li></ul><ul><ul><li> </li></ul></ul><ul><li>Attend More MSDN Events </li></ul>
    41. 41. MS Press Essential Resources for Developers Microsoft® Visual Studio® .NET is here! This is your chance to start building the next big thing. Develop your .NET skills, increase your productivity with .NET Books from Microsoft Press®
    42. 42. Become A Microsoft Certified Solution Developer <ul><li>What Is MCSD? </li></ul><ul><ul><li>Premium certification for professionals who design and develop custom business solutions </li></ul></ul><ul><li>How Do I attain MCSD Certification? </li></ul><ul><ul><li>It requires passing four exams to prove competency with Microsoft solution architecture, desktop applications, distributed application development, and development tools </li></ul></ul><ul><li>Where Do I Get More Information? </li></ul><ul><ul><li>For more information about certification requirements, exams, and training options, visit </li></ul></ul>
    43. 43. Training Training Resources for Developers <ul><li>Course Title: </li></ul><ul><ul><li>Course Number: </li></ul></ul><ul><ul><li>Availability: </li></ul></ul><ul><ul><li>Detailed Syllabus: </li></ul></ul><ul><li>Course Title: </li></ul><ul><ul><li>Course Number: </li></ul></ul><ul><ul><li>Availability: </li></ul></ul><ul><ul><li>Detailed Syllabus: </li></ul></ul>To locate a training provider for this course, please access Microsoft Certified Technical Education Centers are Microsoft’s premier partners for training services
    44. 44. Finding me. <ul><li>[email_address] </li></ul><ul><li> </li></ul><ul><li> </li></ul><ul><li> </li></ul>