Presentation is loading. Please wait.

Presentation is loading. Please wait.

A Little Bit of Active Server Pages (ASP)

Similar presentations


Presentation on theme: "A Little Bit of Active Server Pages (ASP)"— Presentation transcript:

1 A Little Bit of Active Server Pages (ASP)
Jim Fawcett CSE681 – Software Modeling and Analysis Fall 2004

2 ASP Environment ASP lives only in Microsoft’s Internet Information Server (IIS) It started out as a server-side scripting language Used to create dynamic web pages, depending on things like: Application context Session context Data from server For many of its activities it depended upon server-side COM objects. Under .Net it has grown to support use of fully object oriented programming languages: C# code behind, for example

3

4 Server Object Model Application Object Request Object Reponse Object
Data sharing and locking across clients Request Object Extracts client data and cookies from HTTP request Reponse Object Send cookies or call Write method to place string in HTML output Server Object Provides utility methods Session Object If browser supports cookies, will maintain data between page loads, as long as session lasts.

5 Server Side Programming with ASP
An Active Server Page (ASP) consists of HTML and script. HTML is sent to the client “as-is” Script is executed on a server to dynamically generate more HTML to send to the client. Since it is generated dynamically, ASP can tailor the HTML to the context in which it executes, e.g., based on time, data from client, current server state, etc.

6 ASP Sample <html> <head>
<title>ASP Example #2</title> <style> body { margin-left: 15%; margin-right: 15% } body { font-size: 14pt } body { font-family: Tahoma } select { font-family: Tahoma; font-size: 14pt } input { font-family: Tahoma; font-size: 14pt } h2 { BACKGROUND: #ffffcc; COLOR: darkred } </style> </head> <body> <center> <h2>CSE691/891 - Internet Programming, Summer 2001</h2> <% ' Option Explicit Dim sTime sTime = Time() Response.Write "<h1>Hello</h1>" %> Server time is <% Response.Write sTime %> </center> <br /> Brought to you by the friendly services of your server Response Object. </body> </html>

7 ASP.Net Sample

8 Introduction to .NET The .NET Platform
Clients Applications ASPWeb Form Web Service Protocols: HTTP, HTML, XML, SOAP, UDDI .NET Framework Tools: Visual Studio.NET, Notepad Each blue box represents a separate computer (or cluster of computers). Windows Your Internal Web Service .NET Foundation Web Services Third-Party Web Services .NET Enterprise Servers

9 ASP Environment

10 <%@ WebService Language="C#" Class="CalcService" %>
using System; using System.Web.Services; [WebService (Name="Calculator Web Service", Description="Performs simple math over the Web")] class CalcService { [WebMethod (Description="Computes the sum of two integers")] public int Add (int a, int b) return a + b; } [WebMethod (Description="Computes the difference between two integers")] public int Subtract (int a, int b) return a - b; ASP Web Service Code on this page and next from: Programming Microsoft .Net, Jeff Prosise, Microsoft Press, 2002

11 Client for Calc Web Service
using System; class MyApp { public static void Main () CalculatorWebService calc = new CalculatorWebService (); int sum = calc.Add (2, 2); Console.WriteLine ("2 + 2 = " + sum); }

12 CalculatorWebService Proxy
Building Proxy source code using WSDL.exe

13 Web Service asmx page in Virtual Directory

14 CalculatorWebService in Action

15 End of Presentation


Download ppt "A Little Bit of Active Server Pages (ASP)"

Similar presentations


Ads by Google