Web engineering 2(lect 2)


Published on

Download it free...

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

Web engineering 2(lect 2)

  1. 1. Web Engineering-II By; Roohul Amin Mashwani
  2. 2. Introduction to ASP.NET 3.5 <ul><li>HTML Forms to Nowhere </li></ul><ul><li>Try This: HTML Data Entry with No Exit </li></ul><ul><ul><li>Your Browser Is a Thin Client </li></ul></ul><ul><ul><li>A Protocol Without a Country: Stateless HTTP </li></ul></ul><ul><li>ASP.NET 3.5 as an Alternative to CGI </li></ul><ul><li>From Client Side to Server Side </li></ul><ul><li>.NET Organization </li></ul><ul><ul><li>Development Contexts </li></ul></ul>
  3. 3. Cont… <ul><ul><li>Running ASP.NET Files on Your Computer or LAN </li></ul></ul><ul><ul><li>ASP.NET in the Real World </li></ul></ul><ul><ul><li>Language Partners with ASP.NET </li></ul></ul>
  4. 4. Introduction to ASP.NET 3.5 <ul><li>In getting started with ASP.NET, you’re entering the world of server-side programming. </li></ul><ul><li>If you’re familiar with languages like PHP you already have some idea of what can be done with server-side processing. </li></ul><ul><li>You will find that ASP.NET has a lot in common with HTML. </li></ul>
  5. 5. HTML Forms to Nowhere <ul><li>In many respects the HTML tags available to create data input are a confusing and frustrating exercise in futility. </li></ul><ul><li>Users can enter information for everything from responses to a questionnaire to an order for a product. </li></ul><ul><li>Using a handy submit button, also available in HTML, you can then send the information to absolutely nowhere. </li></ul>
  6. 6. HTML Data Entry with No Exit <ul><li>Open your favorite text editor, Notepad will suffice, and paste the following HTML code. </li></ul><ul><li>Save the document as nowhere.html . </li></ul><ul><li>Next, open the HTML file in your browser. </li></ul><ul><li>The following HTML code will set up a perfectly clear HTML form that sends information into the ether: </li></ul>
  7. 7. <html> <head> <title>HTML to Nowhere</title> </head> <body> <form> Please enter your name:<br/> <input type=&quot;text&quot; name=&quot;username&quot;/> <p/> Press the button to receive all of your hopes and dreams:<br/> <input type=&quot;submit&quot; value=&quot;Dream Button&quot; /> </form> </body> </html>
  8. 8. Cont… <ul><li>When you test the code after you enter your name and click the Dream Button your output will look just like; </li></ul>
  9. 9. Output HTML data entry and submit form
  10. 10. Cont… <ul><li>Without some kind of mechanism to capture and store the information or pass it on to somewhere else, HTML can’t do. </li></ul><ul><li>What ASP.NET 3.5 offers is a way to store, retrieve, and process the information. </li></ul>
  11. 11. Your Browser Is a Thin Client <ul><li>Your browser’s main job is requesting pages from the server and displaying what the server has processed. </li></ul><ul><li>Using HTTP as a transfer protocol, your browser parses (interprets) the HTML code it gets from the server but otherwise does little processing. </li></ul>
  12. 12. Cont… <ul><li>Because your HTTP client (browser) leaves most of the processing work to the server, it is considered a thin client. </li></ul><ul><li>There’s nothing wrong with a thin client, and it can process JavaScript, Flash, etc. </li></ul><ul><li>With plug-ins, which virtually all browsers have built in. </li></ul>
  13. 13. A Protocol Without a Country: Stateless HTTP <ul><li>HTTP client browser is stateless. </li></ul><ul><li>As soon as a web page reaches your computer, the connection between your browser and the server is broken. </li></ul><ul><li>The browser does not remember the last page—it does not hold state. </li></ul><ul><li>As next page arrives, it does not remember the last page. </li></ul>
  14. 14. Cont… <ul><li>The ASP.NET environment lets you move from a stateless HTTP environment to a state-preserved one. </li></ul>
  15. 15. ASP.NET 3.5 as an Alternative to CGI <ul><li>Microsoft’s alternative to a Common Gateway Interface (CGI) is ASP.NET, now in version 3.5. </li></ul><ul><li>As a unified web platform, ASP.NET provides what you need to develop applications that hold state and use the information that you put into the HTML form. </li></ul>
  16. 16. Cont… <ul><li>Usually, when we think of saving state, we imagine writing the data to a storage device like a hard drive. Using a word processor, every time you save your file, you save its state. </li></ul><ul><li>Using ASP.NET, you can do the same thing with information from anyone who uses your web application. </li></ul>
  17. 17. Cont… <ul><li>Microsoft’s web server, Internet Information Services (IIS), uses the Internet Server API (ISAPI) </li></ul><ul><li>ASP.NET is as a request processing engine that takes incoming requests and sends them to a point where you can attach your C# script to process the request. </li></ul>
  18. 18. Cont… <ul><li>Both C# and Visual Basic.NET (VB.NET) are languages for creating managed code that is efficiently run in the .NET environment. </li></ul><ul><li>Microsoft .NET framework, means an application is executed by a virtual machine rather than by your own processor. </li></ul>
  19. 19. From Client Side to Server Side Browser ASPX file Server- Server executes code; results converted to HTML and returned to client Data reference to ASPX file Returns HTML Client Web Server Server-side script runat=&quot;server&quot;
  20. 20. Cont… <ul><li>The example we’ll look at is saved in an ASP.NET file named Dreamer.aspx. </li></ul><ul><li>In the Dreamer.aspx file, the <form> container includes an input text window just like the HTML file-to-nowhere file, with only a slightly different format: </li></ul><ul><ul><li>Default.aspx-------save </li></ul></ul><ul><ul><li>Dreamer.aspx.cs-------save as </li></ul></ul>
  21. 21. <%@ Page Language=&quot;C#&quot; AutoEventWireup=&quot;true&quot; CodeFile=&quot;Dreamer.aspx.cs&quot; Inherits=&quot;_Dreamer&quot; %> <!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;> <html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;> <head id=&quot;Head1&quot; runat=&quot;server&quot;> <title>Server Side Dreamer</title> </head> <body> <form id=&quot;form1&quot; runat=&quot;server&quot;> <div> Please enter your name:<br /> <asp:TextBox ID=&quot;DreamBox&quot; runat=&quot;server&quot;> </asp:TextBox> <p /> Press the button to receive all of your hopes and dreams:<br /> <asp:Button ID=&quot;Dreamer“ runat=&quot;server“ Text=&quot;Dream Button&quot;OnClick=&quot;DoDream&quot; /> <p /> <asp:Label ID=&quot;Dreams&quot; runat=&quot;server&quot; Text=&quot;Dreams Here&quot;></asp:Label> </div> </form> </body> </html> Example of A Dynamic Website
  22. 22. using System; using System.Data; using System.Configuration; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Xml.Linq; public partial class _Dreamer : System.Web.UI.Page { protected void DoDream(object sender, EventArgs e) { Dreams.Text = DreamBox.Text + &quot;'s dreams are big ones!&quot;; } } Dreamer.aspx.cs
  23. 23. Output
  24. 24. .NET Organization <ul><li>.NET is as a big control system with two key elements. </li></ul><ul><ul><li>.NET framework class library. </li></ul></ul><ul><ul><li>.NET common language runtime. </li></ul></ul>
  25. 25. Cont… <ul><ul><li>.NET framework class library. </li></ul></ul><ul><ul><li>This library has thousands of classes organized into namespaces. </li></ul></ul><ul><ul><li>This library is a repository of reusable types for object-oriented development. </li></ul></ul><ul><ul><li>For example, System.Web.UI Namespace allows you to create several different ASP.NET server controls and user interfaces. </li></ul></ul><ul><ul><li>Each namespace contains a collection of classes. </li></ul></ul>
  26. 26. Cont… <ul><ul><li>The following represent a few of the classes in this namespace: </li></ul></ul><ul><ul><li>● Control </li></ul></ul><ul><ul><li>● Data Binder </li></ul></ul><ul><ul><li>● PageParser </li></ul></ul><ul><ul><li>● UserControl </li></ul></ul><ul><ul><li>To use the classes as well as other structures such as interfaces, you need to include the namespace in your program. </li></ul></ul>
  27. 27. Cont… <ul><ul><li>.NET common language runtime. </li></ul></ul><ul><ul><li>The runtime is a management agent for code as it executes. </li></ul></ul>
  28. 28. Online Help for IIS <ul><li>Click Help or Online Help from within IIS Manager to view the product documentation. </li></ul><ul><li>View the IIS Operations Guide online. </li></ul><ul><li>Visit the official Microsoft IIS website to interact with the community and learn about IIS features. </li></ul>
  29. 29. Thank You All!