Introduction to Web Application Development with.Net and Web Service ISYS 350.

Slides:



Advertisements
Similar presentations
Unit 02. ASP.NET Introduction HTML & Server controls Postbacks Page Lifecycle.
Advertisements

Authenticating Users in an ASP.NET Application. Web Site Administration Tool From VS 2008, click Website/ ASP.Net Configuration to open Web Site Administration.
Shopping Cart Demo. Shopping Cart Search and display product information Add item to cart View cart contents Check out Note: WebsiteCart.
ASP.NET and ADO.NET. ASP.NET Server Controls Intrinsic Controls: These controls correspond to their HTML counterparts. –Ex. Textbox, listbox, button,
VB.NET Database Tools ISYS Net Applications OLE DB Provider OLE DB Data Source OLE DB Provider ODBC Data Source SQL Server Data Source SQL Server.Net.
Coding ADO.NET Objects: Connection, Command, DataReader.
Website Security ISYS 512. Authentication Authentication is the process that determines the identity of a user. Web.config file – node Options: –Windows.
ASP.Net AJAX. AJAX Asynchronous JavaScript and XML: – JavaScript, Document Object Model, Cascade Style Sheet, XML, server-side script such as.Net, etc.
ASP.NET and ADO.NET. ADO.NET Objects Data Set.NET Applications Data Reader Command Object Connection Object Managed Data Provider (OLEDB) Database.
Introduction to ASP.Net
Web Site Security ISYS 512/812. Authentication Authentication is the process that determines the identity of a user. Web.config file – node Options: –Windows:
Coding ADO.NET Objects: Connection, Command, DataReader.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
Working with Session and Application Objects. Postback and Variables Variables declared in a web page including ADO.Net objects may be reinitialized and.
Concurrency Control. R/RR/W W/W User 2 ReadWrite User 1 Read Write R/W: Inconsistent Read problem. W/W: Lost Update problem.
VB.NET Database Tools ISYS 573. Microsoft Universal Data Access ODBC: Open Database Connectivity –A driver manager –Used for relational databases OLE.
ASP.NET and ADO.NET. Bind the DataReader to a DataGrid Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = c:\sales2k.mdb" Dim objConn.
Coding ADO.NET Objects: Connection, Command, DataReader.
Working with Session. Postback and Variables Variables declared in a web page including ADO.Net objects may be reinitialized and lose their values.
Introduction to VB.Net Internet Tools. Web Server Default directory –C:\InetPub\wwwroot –Computer lab: Zip drive dchao Default home page –Default.aspx,
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
Chapter 11 ASP.NET JavaScript, Third Edition. 2 Objectives Learn about client/server architecture Study server-side scripting Create ASP.NET applications.
Website Security ISYS 512. Cookies Data in Cookies System.Web Which web site set the cookie Expiration date –DateTime data type –TimeSpan data type One.
Introduction to Web Service ISYS 512. Web Service XML Web Service Web services are classes that are stored on the web which can instantiate and use in.
ASP and HTML. Anchor Tag testAnchorTag Demo: ASPNet/ASPNETProdListSelf.ASPX.
Introduction to ASP.Net ISYS 350. ASP.NET ASP.NET is a server-side technology for creating dynamic web pages. ASP.NET allows you to use a selection of.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
DR.JOHN ABRAHAM PROFESSOR UTPA ASP.NET. ACTIVE SERVER PAGES (ASP) Web application development environment Web applications use web browser to display.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
INSPIRING CREATIVE AND INNOVATIVE MINDS Module 4: Adding Code to a Microsoft ASP.NET Web Form Implementing Code-Behind Pages Adding Event Procedures to.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
© Minder Chen, ASP.NET 2.0: Introduction - 1 ASP.NET 2.0 Minder Chen, Ph.D. Framework Base Class Library ADO.NET: Data & XML.
Internet Technologies and Web Application Web Services With ASP.NET Tutorial: Introduction to.
Introduction to XML and Web Service ISYS 464. HTML vs XML HTML is a language specifically designed for displaying information in browser. It doesn’t carry.
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
ASP.NET - accessing the database - datareader vs dataset - datagrid vs datalist - brief look at web matrix.
Introduction to ASP.NET1. 2 Web applications in general Web applications are divided into two parts –The server part –The client part The server part.
Website Security ISYS 512. Authentication Authentication is the process that determines the identity of a user.
Introduction to Web Service ISYS 512. Web Service XML Web Service Web services are classes that are stored on the web which can instantiate and use in.
ASP.Net and HTML. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load dim strConn as string ="Provider=Microsoft.Jet.OLEDB.4.0;Data.
Web Development in Microsoft Visual Studio Slide 2 Lecture Overview How to create a first ASP.NET application.
Module 3: Using Microsoft.NET- Based Languages. Overview Overview of the.NET-Based Languages Comparison of the.NET-Based Languages.
Introduction to ADO.Net and VS Database Tools and Data Binding ISYS 350.
1 CS 3870/CS 5870: Note 20 Web Service. 2 What is Web Service? Providing functionality online to other applications, Web and Windows applications. The.
Week Six : Writing Web Services Aims: Creating and Consuming student’s first Web Services Learning Outcomes: Familiarity with VS.NET for creating and consuming.
Introduction to XML and Web Service ISYS 512/812.
Created by Alia Al-Abdulkarim 2008 Visual Basic Vs. Java.
1 CS 3870/CS 5870: Note 13 Web Service. 2 What is Web Service? Providing functionality online to other Web applications SOAP Simple Object Access Protocol.
ADO.NET Objects Data Adapters Dr. Ron Eaglin. Agenda Builds on Information in Part I Should have working knowledge of creating a database connection Continuation.
C# Classes ISYS 512. Introduction to Classes A class is the blueprint for an object. –It describes a particular type of object. –It specifies the properties.
C# Classes ISYS 512. Introduction to Classes A class is the blueprint for an object. –It describes a particular type of object. –It specifies the properties.
 ASP.NET provides an event based programming model that simplifies web programming  All GUI applications are incomplete without enabling actions  These.
Shopping Cart Demo. Shopping Cart Search and display product information Add item to cart View cart contents Check out.
Coding ADO.NET Objects: Connection, Command, DataReader.
Coding ADO.NET Objects: Connection, Command, DataReader
ASP.NET and ADO.NET.
Web Services Introduction
ASP.Net Demo ISYS 350.
Web Form Introduction.
Coding ADO.NET Objects: Connection, Command, DataReader
Database Handling Class and Service
ASP.NET and ADO.NET.
VB Classes ISYS 512.
Working with Session and Application Objects
Command Object’s ExecuteNonQuery Method
Presentation transcript:

Introduction to Web Application Development with.Net and Web Service ISYS 350

Web Server Web Server: –Built-in Web Server VS 08 uses the built-in web server for debugging. Localhost website for testing Default home page –Default.aspx, default.asp, default.htm

HTML Form vs.Net Web Form HTML form:Created using HTML tags –Example: Fullname.htm first Name: Last Name: Full Name:.Net web form: Created using ASP.Net controls

Client-Side vs Server-Side Script Client-side: Script is executing on client- side –JavaScript Server-side: Script is executing on server- side and produce HTML code as output. –ASP.Net –Java Servlets and JSP –PHP –Etc.

JavaScript Example function calcJS(){ var fName, lName; fName=document.formControl.T1.value; lName=document.formControl.T2.value; document.formControl.T3.value=fName + " " + lName; } --> first Name: Last Name: Full Name:

Benefits of Server-Side Technology Browser compatibility: Every browser reads HTML. Protection of source code. Controls are server-side objects with properties, methods and events.

Web Project File/New Website/ ASP.Net Website Website folder Web form: –default.aspx Design view and source view Add a new page: –Website/Add New Item/Web form To set start up page: –Point to the web page in the Solution Explorer and right click to choose Set As Start Page.

Create a web page to add two numbers Add controls: –Format/Set position/Absolute

Monthly Payment of a Loan Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim term, intRate, payment As Double intRate = ListBox1.SelectedValue term = RadioButtonList1.SelectedValue payment = Pmt(intRate / 12, term * 12, - CDbl(TextBox1.Text)) TextBox2.Text = payment End Sub

Data Grid Creating bound DataGrid by dragging a table from the Server Explorer

Working with Multiple Pages Redirect or transfer to another page: –Server.Transfer(“page name”) –Response.Redirect(“page name”)

Working with ADO.Net (DataReader can be used as a data source) Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = c:\salesDB.mdb" Dim objConn As New OleDbConnection(strConn) Dim strSQL As String = "select * from customer;" Dim objComm As New OleDbCommand(strSQL, objConn) objConn.Open() Dim objDataReader As OleDbDataReader objDataReader = objComm.ExecuteReader() GridView1.DataSource = objDataReader GridView1.DataBind()

Select a Rating from RadiobuttonList and Display Customers with that Rating Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = c:\salesDB.mdb" Dim objConn As New OleDbConnection(strConn) Dim strSQL As String = "select * from customer where rating = '" + RadioButtonList1.SelectedValue + "'" Dim objComm As New OleDbCommand(strSQL, objConn) objConn.Open() Dim objDataReader As OleDbDataReader objDataReader = objComm.ExecuteReader() GridView1.DataSource = objDataReader GridView1.DataBind()

Postback Postback is the process by which the browser posts information back to the server telling the server to handle the event, the server does so and sends the resulting HTML back to the browser. Button control triggers the postback when clicked; other controls need to set the AutoPostBack property to true.

Working with Database Class Add a class: –Website/Add New Item/Class –Classes with be placed in a App_Code folder Adding an existing item –Example: Adding the Customer class created earlier.

Working with an Assembly Website/Add refernce/Browse for the assembly

Web Service XML Web Service Web services are classes that are stored on the web which can instantiate and use in both Windows and Web applications.

To Add a New Web Service: Website/Add New Item/Web Service –Web Service has an extension: ASMX –The CodeBehind File is stored in the App_Code folder. Web Services are defined as Web Method: – programmed as a function with return value: – Public Function GetCname(ByVal CID As String) As String

A Web Service Example Public Class MyWebService Inherits System.Web.Services.WebService Public Function GetCname(ByVal CID As String) As String Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = c:\salesDB.mdb" Dim objConn As New OleDbConnection(strConn) Dim strSQL As String = "select * from customer where CID = '" & CID & "';" Dim objComm As New OleDbCommand(strSQL, objConn) objConn.Open() Dim objDataReader As OleDbDataReader objDataReader = objComm.ExecuteReader() If objDataReader.Read() Then Return objDataReader("Cname") Else Return ("Not exist") End If End Function End Class

Web Service Description Language (WSDL) A WSDL file is an XML document containing a complete description of the web service. It shows a web service’s name, methods, and parameter types. Help page: After entering web service’s URL, a help page is displayed. You can click the Service Description link to see the WSDL file.

Consuming Web Services from a Web Application Add a web reference to the web service: –Website/Add Web Reference Within this soulution Local computer Internet Imports the web service Declare a web service class variable. –Dim UseWs As New DBWebService

Example Imports localhost.Service1 Partial Class Default3 Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim WS As New localhost.Service1 TextBox2.Text = WS.GetCname(TextBox1.Text) End Sub End Class

Web Service that Returns an Object (Customer Object) Public Function GetCustomer(ByVal CID As String) As Customer Dim myCust As New Customer myCust.getData(CID) If myCust.RecExist Then Return myCust Else myCust.cid = CID myCust.CName = "NA" myCust.City = "NA" myCust.Rating = "NA" Return myCust End If End Function

Using the Service Dim WS As New WebService2 Dim myCust As New Customer myCust = WS.GetCustomer(TextBox1.Text) TextBox2.Text = myCust.CName TextBox3.Text = myCust.City TextBox4.Text = myCust.Rating

Reference a Web Service on Internet Mortgage calculator This web service return an object of MortgageResults type with more than one properties.

Example Dim WS As New Mortgage.Mortgage Dim WSResult As MortgageResults WSResult = WS.GetMortgagePayment(10, 0.05, 2000, 0, 0) TextBox2.Text = WSResult.TotalPayment.ToString