html5-img
1 / 15

ASP.Net & Web Server

ASP.Net & Web Server. Server-side Processing ASP.Net Basics Creating a simple ASP.Net Page VB Language Elements ASP.Net Web Controls. Server-side Page Processing. HTTP Request. HTTP Response. Client. Web Server. Web Page. VB. Web Server. C#. Language Engines. ActiveX Data Objects.

lana-hoover
Download Presentation

ASP.Net & Web Server

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 & Web Server • Server-side Processing • ASP.Net Basics • Creating a simple ASP.Net Page • VB Language Elements • ASP.Net Web Controls

  2. Server-side Page Processing HTTP Request HTTP Response Client Web Server Web Page VB Web Server C# Language Engines ActiveX Data Objects Database Source: Active Server Pages, Wille & Koller, Sams Publishing

  3. What is ASP.Net • ASP.NET is a technology for creating dynamic Web applications. It is part of the .NET Framework • You can author ASP.NET applications in most .NET compatible languages, including Visual Basic, C#, and J#. • ASP.NET pages (Web Forms) are compiled, providing better performance than with scripting languages. • Web Forms allow you to build powerful forms-based Web pages. When building these pages, you can use ASP.NET server controls to create common UI elements, and program them for common tasks. These controls allow you to rapidly build a Web Form out of reusable built-in or custom components, simplifying the code of a page. - Microsoft Website

  4. OtherTechnologies for Server-side Scripting • Common Gateway Interface (CGI) • Most applications written in C or Perl • Enables developers to create fast and powerful applications • Each client request creates a new process taking up server resources • Hard to maintain and debug • Internet Server API (ISAPI) • Applications written in C/C++ or Delphi • Applications implemented as dynamic link libraries and loaded into the Internet Server process space • Complex to program and maintain • A programming error can crash the entire web server

  5. <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default3.aspx.vb" Inherits="Default3" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <h1 style="text-align: center">First ASP.Net Page</h1> <% Dim d1 As Date Dim x As Integer d1 = Date.Now x = Date.DaysInMonth(2006, 10) Response.Write("<p>Today is " & d1 & ". Have a nice day!</p>") Response.Write("<p>There are " & x & " days in this month and year.</p>") %> </div> </form> </body> </html>

  6. Start-up Code for asp.net file (Default.aspx) <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default3.aspx.vb" Inherits="Default3" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> </div> </form> </body> </html>

  7. Elements of ASP.Net Page • <%@ page declarative %> • VB, J#, C# languages • HTML, Client-side, & Server-side code • Script level declarative optional <script language=“VB” RUNAT=“server”> ………statements </script> • VB used is object-oriented and strongly typed

  8. VB Language Essentials • Declaring variables Dimvariable as Type Dim d1 as Date Dim x, y as Integer Dim z as Single Dim w as Double Dim myname as String Dim misc as Object (a catchall type, to be avoided)

  9. VB Language Essentials • Operators • Mathematical: +, -, *, /, % • Assignment: = • Logical: >, <, >=, <=, <>, AND, OR, NOT • E.g., If x<100 AND x<>90 Then x = x+10 Else x = x+5 End If (If x less than 100 AND x not equal to 90 Then)

  10. VB Language Essentials • If statements If condition Then statements if condition is true Else statements if condition is false End If

  11. VB Language Essentials • For loops For x = initial value To final value Step value statements within the for loop Next n=20 For x = 1 To n Step 2 Response.Write “Value of X is “ & x total = total + x Next

  12. VB Language Essentials • Do While loop Do While condition statements within while loop Loop Dim x,n, total as Integer x=1 n=20 total = 0 Do While x<=n Response.Write “X is ” & x x = x+1 total = total + x Loop

  13. VB Language Essentials • Variations of Do loop Do statements within loop Loop While condition Do Until condition statements within loop Loop Do statements within loop Loop Until condition

  14. VB Language Essentials • Sub-routines Sub printtimes(n as Integer) Dim x as Integer For x = 1 To n Response.Write “Printing ” & x & “time” Next End Sub • Calling subroutines <% Dim n1 as Integer n1=10 printtimes(n1) %>

  15. VB Language Essentials • Functions Function findtotal(n as Integer) Dim x, total as Integer total = 0 For x = 1 To n total = total+x Next Return total End Function • Calling functions <% Dim n1 as Integer n1=10 Response.Write “Total is ” & findtotal(n1) %>

More Related