1 / 32

ASP.NET

ASP.NET. Reuven Abliyev Elyahu Sivaks Ariel Daliot. What is ASP.NET?. Microsoft’s web page: “Framework for writing dynamic, high-performance Web applications” O’Reilly Nutshell:

jude
Download Presentation

ASP.NET

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ASP.NET Reuven Abliyev Elyahu Sivaks Ariel Daliot

  2. What is ASP.NET? • Microsoft’s web page: “Framework for writing dynamic, high-performance Web applications” • O’Reilly Nutshell: “Programming framework built on the common language runtime that can be used on a web server to build powerful Web applications” • In other words:“Great web pages in a short time, less code”

  3. Why ASP.NET? 10 years of evolution in 10 slides • Why ASPnotNET? • Why HTML?

  4. HTML – HyperText Markup Language • Commands denote certain text as headings, paragraphs, lists, text format, fonts, links, etc. • HTML is static – i.e. pages cannot change on the request of the user, must be changed explicitly

  5. HTML Example <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Seminar in Software Design - 2005/6</title> <link href="style.css" type="text/css" rel="stylesheet"> <style> .detailprop { font-size: 12pt; font-weight: bold; color: #003366; } </style> </head> <body> <!-- large frame --> <table cellpadding="0" cellspacing="0" width="100%" border="0"><tr><td style="padding-right:20px;"> <!-- /large frame --> <table id="headerTable" cellpadding="0" cellspacing="0"> <tr> <table id="content" cellpadding="0" cellspacing="0" width="100%" border="0"> <tr> <td valign="top" width="150" style="padding-right:15px;"> <!-- Side menu--> <table id="sidemenu" class="borderedtable" cellpadding="0" cellspacing="0" width="140"> <tr> <td class="sidemenuitem" width="134"> <p align="center"><a href="index.html" ><font size="2" color="#000080"> Information</font></a></td> </tr> <td class="sidemenuitem" width="134" align="center"><a href="schedule.html" > Schedule</a></td> </tr> <tr> <td class="sidemenuitem" width="134" align="center"><a href="guidelines.html"> Guidelines</a></td> </tr>

  6. Suppose user enters URL www.cs.huji.ac.il/~ssd 1a. HTTP client initiates TCP connection to HTTP server (process) at www.cs.huji.ac.il on port 80 How do web pages work - HTTP (contains text, references to 10 jpeg images) 1b. HTTP server at host www.cs.huji.ac.ilwaiting for TCP connection at port 80. “accepts” connection, notifying client 2. HTTP client sends HTTP request message (containing GET command) into TCP connection socket. Message indicates that client wants object ~ssd/index.htm 3. HTTP server receives request message, forms aresponse message containing html, and sends message into its socket time

  7. 5. HTTP client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objects HTTP (cont.) 4. HTTP server closes TCP connection. time 6.Steps 1-5 repeated for each of 10 jpeg objects 7.Client can return request message with POST command holding form input

  8. HTTP request message • two types of HTTP messages: request, response • HTTP request message: • ASCII (human-readable format) request line (GET, POST, HEAD commands) GET /somedir/page.html HTTP/1.1 Host: www.someschool.edu User-agent: Mozilla/4.0 Connection: close Accept-language:fr (extra carriage return, line feed) header lines Carriage return, line feed indicates end of message

  9. HTTP response message status line (protocol status code status phrase) HTTP/1.1 200 OK Connection close Date: Thu, 06 Aug 1998 12:00:15 GMT Server: Apache/1.3.0 (Unix) Last-Modified: Mon, 22 Jun 1998 …... Content-Length: 6821 Content-Type: text/html data data data data data ... header lines data, e.g., requested HTML file

  10. DHTML- Dynamic HTML • Enables adding high-level logic in the HTML page in the form of javascript functions • Scripts run client-side • Competing techniques include Macromedia Flash (for animation) and applets • Most recent HTML technology is XHTML

  11. DHTML Example <html> <head><title>Test</title> <style type="text/css"> h2 {background-color: lightblue; width: 100%} a {font-size: larger; background-color: goldenrod} a:hover {background-color: gold} #example1 {display: none; margin: 3%; padding: 4%; background-color: limegreen} </style> <script type="text/javascript"> <!– function changeDisplayState (id) { e=document.getElementById(id) if (e.style.display == 'none' || e.style.display =="") { e.style.display = 'block' this.innerHTML = 'Hide example'} else { e.style.display = 'none' this.innerHTML = 'Show example'} } // --> </script> </head> <body>

  12. Server-side dynamic web page technologies • CGI – Common Gateway Interface (~1993): • Enables a client web browser to request data from a program executed on the web server • Client doesn’t need to know much more than HTML • Each page is actually a *.cgi text file with script commands (typically perl but can be any language) • An instance of the code interpreter is executed for every CGI request! • Parameters are passed through the URL • Example: http://cs.huji.ac.il/~ssd/test.cgi?p1=val1&p2=val2

  13. CGI Example in C /*********************************************************************** **/ /** **/ /** hello_s.cgi: simple "hello, world", to demonstrate basic CGI output. **/ /** **/ /*********************************************************************** **/ #include <stdio.h> void main() { /** Print the CGI response header, required for all HTML output. **/ /** Note the extra \n, to send the blank line. **/ printf("Content-type: text/html\n\n") ; /** Print the HTML response page to STDOUT. **/ printf("<html>\n") ; printf("<head><title>CGI Output</title></head>\n") ; printf("<body>\n") ; printf("<h1>Hello, world.</h1>\n") ; printf("</body>\n") ; printf("</html>\n") ; exit(0) ; }

  14. ASPnotNET…Active Server Pages • Microsoft’s server-side technology for dynamically-generated web pages • Marketed in 1996 as an add-on to Internet Information Services (IIS) • Mixes server-side code with client-side HTML • Code executed by the server’s ASP engine • Example: (pages have *.asp extensions)http://cs.huji.ac.il/~ssd/test.asp?p1=val1&p2=val2

  15. ASP Example <html> <body> This page is executed on date <% response.write(date()) %> and time <% response.write(time()) %> . </body> </html> ---------------------------- This page is executed on date 17.11-2005 and time 10:00.

  16. ASPnotNet • The code between the <% ... %> delimiters is processed by the server • Programming ASP is made easier by various objects that correspond to a group of frequently-used functionalities useful for creating dynamic web pages • Six such built-in objects: Application, ASPError, Request, Response, Server and Session

  17. Disadvantages of ASPnotNet • The code is cumbersome to write and read • Code can only be written in Jscript or VBscript • Code is interpreted and not compiled • The “<%” directive causes the interpreter to be loaded every time at the server • No separation between the graphical aspects of the page and the programmatic ones • Difficult to program the page controls

  18. ASP.NET – Fixes the previous points (2001) • Complete separation between code and HTML • Code uses the .NET framework with all its advantages Supports any language that can use the .NET framework (C#, J#, VB.NET, Perl.NET, C++, etc…) • Code is compiled and thus much more efficient • Pages have the*.aspxextensions • Enhanced security: User authentication, with accounts and roles • Very easy to design pages using drag-n-drop • Controls are easily programmed • Very easy deployment, no need to register dlls • Can benefit from the advantages of Visual Studio

  19. “Complete separation between code and HTML”

  20. GUI Controls • There are server-side controls (code-behind, rich features, easy to change, validation) • Client-side controls (html, no code-behind…) • User-defined controls (customized)

  21. Server-control validation example

  22. The .NET framework • Collection of over 4500 classes for rich functionalities: Data streaming, GUI, XML, Data access, Networking, Security, etc…(whatever you have in JAVA) • These classes are called the .NET Framework Class Library (FCL) • Has a platform independent language: MSIL – MS Intermediate Language • There are about 25 languages that have compilers to IL • The language compiler compiles the code to IL • Common Language Runtime (CLR) is the execution environment for code written for the .NET Framework • The CLR does the compilation of the IL code to the native code

  23. How a .NET program is compiled

  24. The .NET framework (cont.) The CLR manages the execution of .NET code, including: • memory allocation • garbage collection (which helps avoid memory leaks) • security (including applying differing trust levels to code from different sources) • thread management • enforcing type-safety

  25. ASP.NET page life-cycle: Browser request an ASP.NET page ASP.NET engine checks for changes in the IL code for the requested page changed not changed Recompilation of code, new IL CLR compiles IL to executable Execution => HTML sent back

  26. Performance (fromwww.microsoft.com) • Microsoft .NET Outperforms J2EE:  • Similar functionality uses 1/4th lines of code • Executes 28x faster • Supports 7.6x as many concurrent users • With only 1/6th processor utilization • Applications that migrated from classic ASP see a 3x to 5x increase in pages served

  27. What's behind it • Compiled execution • Dynamic compilation. ASP.NET will automatically detect any changes and dynamically compile the files • Page output cached on server • Memory Leak, DeadLock and Crash Protection • Web-Farm Session State

  28. Security • Authentication – verifying who you are • Authorization – verifying what you are allowed to do • ASP.NET provides three built-in options for authentication: • Windows authentication • Forms authentication • Passport authentication

More Related