CIS 445 Advanced Visual Basic.NET ASP.NET



Similar documents
Short notes on webpage programming languages

c. Write a JavaScript statement to print out as an alert box the value of the third Radio button (whether or not selected) in the second form.

ASP &.NET. Microsoft's Solution for Dynamic Web Development. Mohammad Ali Choudhry Milad Armeen Husain Zeerapurwala Campbell Ma Seul Kee Yoon

ASP.NET: THE NEW PARADIGM FOR WEB APPLICATION DEVELOPMENT

Government Girls Polytechnic, Bilaspur

Transition your MCPD Web Developer Skills to MCPD ASP.NET Developer 3.5 (VB)

Dynamic Web Pages with ASP.NET. Hanspeter Mössenböck

Client-side Web Engineering From HTML to AJAX

InternetVista Web scenario documentation

Configuring IBM WebSphere Application Server 7.0 for Web Authentication with SAS 9.3 Web Applications

Advanced Web Application Development using Microsoft ASP.NET

JavaScript Basics & HTML DOM. Sang Shin Java Technology Architect Sun Microsystems, Inc. sang.shin@sun.com

Introduction to ASP.NET and Web Forms

Implementing Specialized Data Capture Applications with InVision Development Tools (Part 2)

HOUR 3 Creating Our First ASP.NET Web Page

Internet Technologies

Configuring iplanet 6.0 Web Server For SSL and non-ssl Redirect

JavaScript By: A. Mousavi & P. Broomhead SERG, School of Engineering Design, Brunel University, UK

Intell-a-Keeper Reporting System Technical Programming Guide. Tracking your Bookings without going Nuts!

InPost UK Limited GeoWidget Integration Guide Version 1.1

ASP.NET. Web Programming. Telemark University College Department of Electrical Engineering, Information Technology and Cybernetics

multiple placeholders bound to one definition, 158 page approval not match author/editor rights, 157 problems with, 156 troubleshooting,

PHP Tutorial From beginner to master

The Comparison of J2EE and.net for e-business

Advanced Web Application Development using Microsoft ASP.NET

COURSE CURRICULUM COURSE TITLE: WEB PROGRAMMING USING ASP.NET (COURSE CODE: )

VB.NET - WEB PROGRAMMING

Programming in C# with Microsoft Visual Studio 2010

«W3Schools Home Next Chapter» JavaScript is THE scripting language of the Web.

Overview. In the beginning. Issues with Client Side Scripting What is JavaScript? Syntax and the Document Object Model Moving forward with JavaScript

Sample Chapters. To learn more about this book visit Microsoft Learning at:

Introduction. ASP to ASP.NET MIGRATION. Executive Summary


Novell Identity Manager

Crystal Reports. For Visual Studio.NET. Reporting Off ADO.NET Datasets

Building and Using Web Services With JDeveloper 11g

Design and Functional Specification

LICENSE4J AUTO LICENSE GENERATION AND ACTIVATION SERVER USER GUIDE

2311A: Advanced Web Application Development using Microsoft ASP.NET Course 2311A Three days Instructor-led

JavaScript: Introduction to Scripting Pearson Education, Inc. All rights reserved.

Ipswitch Client Installation Guide

Expanded contents. Section 1. Chapter 2. The essence off ASP.NET web programming. An introduction to ASP.NET web programming

2. Modify default.aspx and about.aspx. Add some information about the web site.

Data Transfer Tips and Techniques

Visual COBOL ASP.NET Shopping Cart Demonstration

Citrix EdgeSight for NetScaler Rapid Deployment Guide

JOSSO 2.4. Internet Information Server (IIS) Tutorial

ASP Tutorial. Application Handling Part I: 3/15/02

Developing and Implementing Windows-Based Applications With Microsoft Visual C#.NET and Microsoft Visual Studio.NET

Working with forms in PHP

ResPAK Internet Module

Internet Engineering: Web Application Architecture. Ali Kamandi Sharif University of Technology Fall 2007

Developing and Implementing Web Applications with Microsoft Visual C#.NET and Microsoft Visual Studio.NET

INFORMATION BROCHURE Certificate Course in Web Design Using PHP/MySQL

A Comparison of Web Development Technologies: WebObjects vs. ASP.NET

NiceLabel Control Center 6.5. Release Notes. Rev-1504

Porting Legacy Windows Applications to the Server and Web

Design Approaches of Web Application with Efficient Performance in JAVA

Forms, CGI Objectives. HTML forms. Form example. Form example...

Installation & Configuration Guide Version 2.2

WIRIS quizzes web services Getting started with PHP and Java

What's New in BarTender 2016

Dynamic Web Programming BUILDING WEB APPLICATIONS USING ASP.NET, AJAX AND JAVASCRIPT

HOW TO CONFIGURE PASS-THRU PROXY FOR ORACLE APPLICATIONS

Migrating helpdesk to a new server

Introduction to Web Design Curriculum Sample

INTERNET PROGRAMMING AND DEVELOPMENT AEC LEA.BN Course Descriptions & Outcome Competency

HP Service Manager. Collaboration Guide. For the Supported Windows and UNIX operating systems. Software Version: 9.31

Appendix F: Instructions for Downloading Microsoft Access Runtime

Chapter 1 Programming Languages for Web Applications

MOVING THE SENIOR DEVELOPMENT CLASS FROM WEB DEVELOPMENT TO LIFE CYCLE DEVELOPMENT A CASE FOR VISUAL STUDIO 2005

Multimedia im Netz Online Multimedia Winter semester 2015/16. Tutorial 03 Major Subject

NGASI AppServer Manager SaaS/ASP Hosting Automation for Cloud Computing Administrator and User Guide

Slide.Show Quick Start Guide

Lab 8: ASP.NET 2.0 Configuration API and Health Monitoring

Performance Testing for Ajax Applications

HOW TO DEPLOY AN EJB APLICATION IN WEBLOGIC SERVER 11GR1

Website Login Integration

Using Form Tools (admin)

Technical University of Sofia Faculty of Computer Systems and Control. Web Programming. Lecture 4 JavaScript

Glassfish Architecture.

The full setup includes the server itself, the server control panel, Firebird Database Server, and three sample applications with source code.

How to configure the DBxtra Report Web Service on IIS (Internet Information Server)

Application Security

To install Multifront you need to have familiarity with Internet Information Services (IIS), Microsoft.NET Framework and SQL Server 2008.

TIBCO Spotfire Automation Services Installation and Configuration

Web Conferencing Version 8.3 Troubleshooting Guide

Witango Application Server 6. Installation Guide for Windows

Jolly Server Getting Started Guide

IMRG Peermap API Documentation V 5.0

JavaScript and Dreamweaver Examples

Iron Speed Designer Installation Guide

Transcription:

California State University Los Angeles CIS 445 Advanced Visual Basic.NET ASP.NET (Part 1), PhD jwoo5@calstatela.edu California State University, LA Department Computer s Part1 The Fundamentals of ASP.NET Contents Introduction.NET Fundamentals ASP.NET simple syntax ASP.NET page Mulithoming for Hosts on IPv6 1

.NET.NET Microsoft has presented.net solution in June 2000 Want to compete with J2EE Want to occupy the world ASP.NET Better Language Support Programmable Controls Event Driven Programming XML Based Components User Authentication, with Accounts and Roles Higher Scalability Increased Performance - Compiled Code Easier Configuration and Deployment Not Fully ASP Compatible.NET (Cont d).net Mainly web solution Platform Independent Final goal but not now Language Independent Visual Basic.NET, C++.NET, C#.NET, ASP.NET, ADO.NET Component Model Easy to distribute Same as EJB Mulithoming for Hosts on IPv6 2

.NET Fundamentals Fundamentals ASP.NET Controls Contains a large set of HTML controls. Almost all HTML elements on a page can be built Event Aware Controls Load, Click and Change events handled by code makes coding much simpler and much better organized ASP.NET Components are heavily based on XML User Authentication Supports forms-based user authentication, including cookie management and automatic redirecting of unauthorized logins. Can still do custom login page and custom user checking.net (Cont d) Fundamentals User Accounts and Roles Give each user (with a given role) access to different server code and executables. High Scalability Server to server communication has been greatly enhanced, making it possible to scale an application over several servers. Compiled Code The first request for an ASP.NET page on the server will compile the ASP.NET code and keep a cached copy in memory. Increases performance Mulithoming for Hosts on IPv6 3

.NET (Cont d) Fundamentals Easy Configuration Configuration of ASP.NET is done with plain text files. Configuration files can be uploaded or changed while the application is running. No need to restart the server Easy Deployment No more server restart to deploy or replace compiled code Compatibility ASP.NET is not fully compatible with earlier versions of ASP, so most of the old ASP code will need some changes to run under ASP.NET. A new file extension ".aspx" This will make ASP.NET applications able to run side by side with standard ASP applications on the same server..net Framework.NET Framework Need to install.net Framework Frame Class Library (FCL) Infrastructure such as transaction, security EJB container Common Language Runtime (CLR) Compiled code from.net language is Microsoft Intermediate Language (MSIL) Codes in different languages can link each other via MSIL Similar to Java IDL CLR should be on each platfrom Similar to JVM Mulithoming for Hosts on IPv6 4

Web Matrix.NET Framework Tool made for ASP.NET development FREE Download http://www.aspmatrix.com/asp-net/webmatrix/index.aspx http://www.asp.net/webmatrix very easy to use, lightweight, and light on system resources Comparing to Visual Studio.NET Has own server Don t need to connect IIS server Need to install IIS server before installing VS.NET You are in trouble now. Do you want to delete and reinstall VS.NET? ASP.NET ASP.NET ASP.NET Active Server Pages in HTML tags of a ASPX file Its function can be written in many languages Similar to JSP ADO.NET ActiveX Data Object Manage data in DBs Similar to JDBC Mulithoming for Hosts on IPv6 5

Dynamic Page in ASP.NET ASP.NET <% --%> tags The code inside the tags is executed on the server. Reponse.Write Writing something to the HTML output stream. Now() A function returning the servers current date and time To execute ASP.NET Not possible in the lab Need IIS web server (MS Windows OS Enterprise Edition) Or Web Matrix ASP.NET Developing tool (Freeware) Download from http://www.asp.net/webmatrix Dynamic Page in ASP.NET (Cont d) ASP.NET Hello.aspx <html> <body bgcolor="yellow"> <center> <h2>hello W3Schools!</h2> <p><%response.write(now())%></p> </center> </body> </html> Mulithoming for Hosts on IPv6 6

hello.aspx (Lab Exam 1) ASP.NET hello.aspx To test the first ASP.NET code Download hello.aspx from the lecture note site And save it to the hard disk Open it from Web Matrix Run it with F5 Connected to Web Matrix Web server Or copy and paste the code to the Html view of Web Matrix in new ASPX file I will let you know how to do it during the lecture ASP.NET With Classic ASP Impossible to separate executable code from the HTML itself Difficult to read, and difficult to maintain pages ASP.NET has solved it with server controls. Server controls are tags that are understood by the server. HTML Traditional HTML tags Web New ASP.NET tags Validation For input validation Mulithoming for Hosts on IPv6 7

HTML Are HTML tags understood by the server HTML elements in ASP.NET files are, by default, treated as text All HTML server controls must be within a <form> tag with the runat="server" attribute runat="server" By adding the attribute to the HTML element in order to make these elements programmable This attribute indicates to treat the element as a server control the form should be processed on the server the enclosed controls can be accessed by server scripts HTML (Cont d) an HtmlAnchor server control example in an.aspx file. Set the href attribute of the HtmlAnchor control in an event handler an event handler is a subroutine that executes code for a given event The Page_Load event <script runat="server"> Sub Page_Load link1.href="http://www.w3schools.com" End Sub </script> <html> <body> <form runat="server"> <a id="link1" runat="server">visit W3Schools!</a> </form> </body> </html> Mulithoming for Hosts on IPv6 8

htmlcontrol.aspx (Lab Exam 2) To test the Html Server Control Download htmlcontrol.aspx from the lecture note site And save it to the hard disk Open it from Web Matrix Run it with F5 Connected to Web Matrix Web server Or copy and paste the code to the All view of Web Matrix in new ASPX file I will let you know how to do it during the lecture Web Are special ASP.NET tags understood by the server. Require a runat="server" attribute Do not necessarily map to any existing HTML elements May represent more complex elements. The syntax for creating a Web server control is: <asp:control_name id="some_id" runat="server" /> Mulithoming for Hosts on IPv6 9

Web (Cont d) Declare a Button server control in an.aspx file. Create an event handler for the Click event which changes the text on the button: Drag Button from Web Control toolbox And drop it into Design view In html view <html> <body> <form runat="server"> <asp:button id="button1" Text="Click me!" runat="server" /> </form> </body> </html> Web (Cont d) <script runat="server"> Sub submit(source As Object, e As EventArgs) webbutton.text="you clicked me!" End Sub </script> <html> <body> <form runat="server"> <asp:button id= webbutton" Text="Click me!" runat="server" OnClick="submit"/> </form> </body> </html> Mulithoming for Hosts on IPv6 10

webcontrol.aspx (Lab Exam 3) To test the Html Server Control Download webcontrol.aspx from the lecture note site And save it to the hard disk Open it from Web Matrix Run it with F5 Connected to Web Matrix Web server Or copy and paste the code to the All view of Web Matrix in new ASPX file I will let you know how to do it during the lecture Validation Used to validate user-input. If the user-input does not pass validation, it will display an error message to the user. Performs a specific type of validation like validating against a specific value or a range of values By default, page validation is performed when a Button, ImageButton, or LinkButton control is clicked. Prevent validation by setting the CausesValidation property to false. The syntax for creating a Validation server control is: <asp:control_name id="some_id" runat="server" /> Mulithoming for Hosts on IPv6 11

Validation (Cont d) Declare one TextBox, Button, and RangeValidator control If validation fails, the text "The value must be from 1 to 100!" will be displayed in the RangeValidator control: Set the properties of RangeValidator ControlToValidate="tbox1" MinimumValue="1" MaximumValue="100" Type="Integer" EnableClientScript="false" Don t need any client script If true, need a script code Text="The value must be from 1 to 100! Error message If the input is not in the range Validation (Cont d) <html> <body> <form runat="server"> Enter a number from 1 to 100: <asp:textbox id="tbox1" runat="server" /> <br /><br /> <asp:button Text="Submit" runat="server" /> <br /> <asp:rangevalidator ControlToValidate="tbox1" MinimumValue="1" MaximumValue="100" Type="Integer" EnableClientScript="false" Text="The value must be from 1 to 100!" runat="server" /> </form> </body> </html> Mulithoming for Hosts on IPv6 12

validcontrol.aspx (Lab Exam 4) To test the Html Server Control Download validcontrol.aspx from the lecture note site And save it to the hard disk Open it from Web Matrix Run it with F5 Connected to Web Matrix Web server Or copy and paste the code to the All view of Web Matrix in new ASPX file I will let you know how to do it during the lecture Event Event The Page_Load Event Triggered when a page loads, Automatically call the subroutine Page_Load, and execute the code inside it: contains no object references or event arguments <script runat="server"> Sub Page_Load lbl1.text="the date and time is " & now() End Sub </script> <html> <body> <form runat="server"> <h3><asp:label id="lbl1" runat="server" /></h3> </form> </body> </html> Mulithoming for Hosts on IPv6 13

event.aspx (Lab Exam 5) To test the Page_Load event Download event.aspx from the lecture note site And save it to the hard disk Open it from Web Matrix Run it with F5 Connected to Web Matrix Web server Or copy and paste the code to the All view of Web Matrix in new ASPX file I will let you know how to do it during the lecture The Page.IsPostBack Property Event Use it if you want to execute the code in the Page_Load subroutine only the FIRST time the page is loaded If the Page.IsPostBack property is false, the page is loaded for the first time, if it is true, the page is posted back to the server (i.e. from a button click on a form): The example next will write the "The date and time is..." message only the first time the page is loaded. When a user clicks on the Submit button, the submit subroutine will write "Hello World!" to the second label, but the date and time in the first label will not change. Mulithoming for Hosts on IPv6 14

The Page.IsPostBack Property Event <script runat="server"> Sub Page_Load if Not Page.IsPostBack then lbl1.text="the date and time is " & now() end if End Sub Sub submit(s As Object, e As EventArgs) lbl2.text="hello World!" End Sub </script> <html> <body> <form runat="server"> <h3><asp:label id="lbl1" runat="server" /></h3> <h3><asp:label id="lbl2" runat="server" /></h3> <asp:button text="submit" onclick="submit" runat="server" /> </form> </body> </html> postback.aspx (Lab Exam 6) To test the Page.IsPostBack property Download postback.aspx from the lecture note site And save it to the hard disk Open it from Web Matrix Run it with F5 Connected to Web Matrix Web server Or copy and paste the code to the All view of Web Matrix in new ASPX file I will let you know how to do it during the lecture Mulithoming for Hosts on IPv6 15

postback.aspx (Lab Exam 6) Modify the part of the code as follows: Test it after removing Not Sub Page_Load if Page.IsPostBack then lbl1.text="the date and time is " & now() end if End Sub Add Shared Variable Shared by Web browsers (users) Dim Shared count As Integer Sub Submit(s As Object, e As EventArgs) visitlabel.text = "current count is:" & count count = count + 1 End Sub Mulithoming for Hosts on IPv6 16