Active Server Pages (ASP.NET) - PDF

Document Sample
Active Server Pages (ASP.NET) - PDF Powered By Docstoc
					Active Server Pages (ASP.NET)


           Presented By

     Manzoor Ahmad Mubashir
        Muhamad Yousaf
          Shahzad Gul
Agenda
• Classic ASP
• ASP & HTML
• What is .NET?
• ASP.NET
• Differences between ASP & ASP.NET
• WHY ASP.NET?
• ASP.NET Architecture
• Dynamic page creation by ASP.NET
 ASP (Active Server Pages)
• First server-side script engine developed and
  released by Microsoft in December 1996.
• Used to create dynamic & interactive web
  applications.
• ASP Page is a simple HTML page containing
  server-side scripts, along with HTML, XML or other
  text. ASP page has an extension .asp
• Default scripting language is VBScript. Other
  scripting engines (JScript, PerlScript etc) can be
  selected.
• ASP uses the Microsoft’s web server (Internet
  Information Services/Server)
• ASP pages are processed by IIS before being sent
  to the user's browser.
• A Simple ASP page                      HTML/Text File
                                        (.htm, .html, .txt)


                                        Change File Extension



                                           ASP Page
                                            (.asp)


<%@ Language=VBScript %> //not necessary if default language to be used is VB
<html>
<title>ABCD</title>
<body>
<%
Var = "Hello World!“
%>
<%=Var%>
</body>
</html>

       Create a new folder under
          C:\Inetpub\Wwwroot (Configure IIS first!)
       Save at C:\Inetpub\Wwwroot\New Folder\new_file.asp
       Run the file in any web browser.
          ASP & HTML
          HTML                       ASP
Does not support          Support server-side
server-side scripts to be scripts to be written in
written in HTML pages. ASP pages.
Scripts can be viewed     Scripts cannot be
from the browser.         viewed from the
                          browser.
Cannot access any         Can access any
Database.                 Database.

Only static pages can     Dynamic pages can be
be created.               created.
Scripts denoted by        Scripts denoted by
delimiters: < >           delimiters: <% %>
          What is .NET?
• Microsoft’s platform for web services and web
  applications.
• Basically, it is a layer between the OS and the
  programming language.
• The .NET platform currently supports around 24
  programming languages including VB.NET, C#,
  J#, C++, Perl etc.
• Provides large set of class libraries that can be
  accessed from the different programming
  languages.
                ASP.NET
• Microsoft product used to develop dynamic
  websites, web applications and web services.
• Previously named as ASP+, successor to ASP.
• First release: January 2002 (.NET framework 1.0)
• Latest release: August 2008 (.NET framework 3.5)
• Microsoft .NET framework constitutes of code
  libraries that enable software and websites
  developed in the .NET environment to run
  smoothly.
• ASP.NET also runs in the Internet Information
  Services/Server (IIS) web server developed by
  Microsoft.
 Differences between
ASP (classic) & ASP.NET
               ASP Classic                                  ASP.NET
Uses less advanced script languages          Uses more advanced and powerful
such as VB script, Jscript, PerlScript for   languages such as C#, VB.NET, J# etc.
coding.
Interpreted language, i.e. code is     Compiled language, i.e. code is
interpreted when the page is executed. compiled to assemblies and loaded at
                                       run time.
Has mixed HTML and coding logic.             Has code-behind development model
                                             to separate business logic from
                                             presentation.
Has limited Object Oriented support.         Completely Object Oriented.


Has limited session and application          Has complete session and application
state management.                            state management.

Poor exception handling system.              Quite an advanced exception handling
                                             system. (try-catch blocks)

Has memory leak, deadlock and crash          No such protection available.
protection.

Supported by very few development            Supported by a variety of powerful
and debugging tools.                         compilers and tools, e.g. Visual Studio
                                             .NET.
           Why ASP.NET?
• It drastically reduces the amount of code required to
build large applications.
• The source code is executed on the web server which
provides lots of power and flexibility to the UI pages.
• The source code is compiled the first time the page is
requested. The server saves the compiled version of the
page for use next time the page is requested which
speeds up the accessing of pages.
•The HTML (and not the application source code)
produced by the ASP.NET page is sent back to the
browser which ultimately enhances security.
• Has lots of built-in validation and security controls.
• ASP.NET applications run faster and counters large
volumes of users without performance problems.
   ASP.NET Architecture




• Web clients communicate with ASP.NET application
through IIS.
• IIS authenticates the request.
• If authentication is not set, no authentication occurs.
• IIS retrieves the requested resource (file).
• If the web client is authorized, IIS returns the requested
resource.
Dynamic Page Creation by ASP.NET

• Tradional way
   • Client requests for the web page.
    Web server sends the (same) web page to the
     client.




    In essense, static pages are sent to the client.
Dynamic Page Creation by ASP.NET
• ASP.NET way
   • Client requests for the web page.
    Web server sends request to the ASP.NET engine.
    A new webpage is created.
    ASP.NET engine sends the created webpage to the
     client.




    In essense, dynamic pages are sent to the client.
Dynamic Page Creation by ASP.NET
   An Example

  <% @Page Language="C#" Debug="true" %>
  <script runat="server">
  void Page_Load(object sender, EventArgs e)
  {
  int hour = DateTime.Now.Hour;
  if( hour <= 11)
  {
  Response.Write("Good Morning.");
  }
  else if( hour <= 18)
  {
  Response.Write("Good Afternoon.");
  }
  else if( hour <= 20)
  {
  Response.Write("Good Evening.");
  }
  else
  {
  Response.Write("Good Night.");
  }
  Response.Write("<br>"+DateTime.Now.ToString());
  }
  </script>
Who is using ASP.NET today?
                   Thank You! 




reference: www.msdn.com