Introduction to VB.Net Internet Tools. Web Server Default directory –C:\InetPub\wwwroot –Computer lab: Zip drive dchao Default home page –Default.aspx,

Slides:



Advertisements
Similar presentations
WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Advertisements

Cookies. Data in Cookies Which web site set the cookie Expiration date –DateTime data type –TimeSpan data type One or more pieces of data Keys Define.
XP Browser and Basics1. XP Browser and Basics2 Learn about Web browser software and Web pages The Web is a collection of files that reside.
JavaScript Forms Form Validation Cookies CGI Programs.
Authenticating Users in an ASP.NET Application. Web Site Administration Tool From VS 2008, click Website/ ASP.Net Configuration to open Web Site Administration.
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.
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.
Web Basics ISYS546. Basic Tools Web server –Default directory, default home page –Virtual directory Web page editor –Front Page Web page languages –HTML,
Shopping Cart. ASP.NET State Management Session: User state Application: Application state Cache Static variables: –Public Shared interestRate as Single.
Introduction to ASP.Net
Introduction to ASP.Net ISYS 512/812. Web Server Web Server: –Internet Information Service: ControlPanel/AdministrativeTools/Internet Information Services.
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.
VB.NET Database Tools ISYS 573. Microsoft Universal Data Access ODBC: Open Database Connectivity –A driver manager –Used for relational databases OLE.
Introduction to Web Application Development with.Net and Web Service ISYS 350.
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.
Server-Side Scripting with ASP.Net ISYS 546. ASP.NET ASP.NET is a server-side technology for creating dynamic web pages. ASP.NET allows you to use a selection.
Coding ADO.NET Objects: Connection, Command, DataReader.
Introduction to ASP.Net ISYS 512. ASP.NET in the.NET Framework 1. The client requests a web page. 2. The web server locates the page. 3. If the page is.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
Cookies. Data in Cookies Which web site set the cookie Expiration date –DateTime data type –TimeSpan data type One or more pieces of data Keys: A collection.
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 VB.Net Internet Tools. Downloading Internet Resources Download the HTML from a web page and display it in a text box. –System.URI A class.
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Beginning Active Server Pages Barry Sosinsky Valda Hilley Programming.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
Computer Concepts 2014 Chapter 7 The Web and .
Internet Protocols & Client Server Programming
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. Azeddine Chikh IS444: Modern tools for applications development.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
Chapter 16 The World Wide Web. 2 The Web An infrastructure of information combined and the network software used to access it Web page A document that.
Cookies. Data in Cookies Which web site set the cookie Expiration date –DateTime data type –TimeSpan data type One or more pieces of data Keys: A collection.
XP New Perspectives on Browser and Basics Tutorial 1 1 Browser and Basics Tutorial 1.
JavaScript, Fourth Edition
E-Commerce: Introduction to Web Development 1 Dr. Lawrence West, Management Dept., University of Central Florida Topics What is a Web.
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.
COMPREHENSIVE Windows Tutorial 4 Working with the Internet and .
Chapter 8 Cookies And Security JavaScript, Third Edition.
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.
Website Development with PHP and MySQL Saving Data.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
Introduction to ASP.Net ISYS 512. ASP.NET in the.NET Framework 1. The client requests a web page. 2. The web server locates the page. 3. If the page is.
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.
Introduction to ASP.Net ISYS 512. ASP.NET in the.NET Framework 1. The client requests a web page. 2. The web server locates the page. 3. If the page is.
ASP. What is ASP? ASP stands for Active Server Pages ASP is a Microsoft Technology ASP is a program that runs inside IIS IIS stands for Internet Information.
XP Browser and Basics COM111 Introduction to Computer Applications.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
Introduction to XML and Web Service ISYS 512/812.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
XP New Perspectives on Microsoft Windows XP Tutorial 5 1 Microsoft Windows XP Bringing the World Wide Web to the Desktop Tutorial 5.
1 More About HTML Images and Links. 22 Objectives You will be able to Include images in your HTML page. Create links to other pages on your HTML page.
INTERNET APPLICATIONS CPIT405 Forms, Internal links, meta tags, search engine friendly websites.
111 State Management Beginning ASP.NET in C# and VB Chapter 4 Pages
Coding ADO.NET Objects: Connection, Command, DataReader
Web Services Introduction
Deepak Shenoy Agni Software
Web Form Introduction.
Coding ADO.NET Objects: Connection, Command, DataReader
Database Handling Class and Service
Presentation transcript:

Introduction to VB.Net Internet Tools

Web Server Default directory –C:\InetPub\wwwroot –Computer lab: Zip drive dchao Default home page –Default.aspx, default.asp, default.htm

Web Project File/New/ ASP.Net Application Website folder Web form: –Webform.aspx Design view and HTML view –WebForm.Aspx.VB CodeBehind

Web Data Form Web Data Form Wizard: –Project/Add Web Form/Data Form Wizard

Bind the DataReader to a DataGrid 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) Dim Results As String objConn.Open() Dim objDataReader As OleDbDataReader objDataReader = objComm.ExecuteReader() DataGrid1.DataSource = objDataReader DataGrid1.DataBind() Note: DataGrid1.DataBind()

ASP.NET ASP.NET is a server-side technology for creating dynamic web pages. ASP.NET allows you to use a selection of full programming languages. The default language is VB.NET. ASP.NET files have a.aspx extension.

ASP.NET Object Model Client Server Request Object Response Object Server Object Session Object Application Object

ASP.NET Request Object When a page is requested, much information is passed along with the request, such as the URL, queryString, and data from a form. The request object allows you to get the information passed along with the request. It is created from the System.Web.HttpRequest class.

FORM Tag Form attribute: –Action: Specify the URL of a program on a server or an address to which a form’s data will be submitted. –Method: Get: the form’s data is appended to the URL specified by the Action attribute as a QueryString. Post: A prefered method for database processing. Form’s data is sent separately from the URL. –Name: Form’s name

QueryString A QueryString is a set of name=value pairs appended to a target URL. It can be used to pass information from one webpage to another. Example: ao

Request Object Collections QueryString – –cid = Request.queryString(“CustID”) –cName=Request.queryString(“CustName”) Form –A form with two text boxes:CustID, CustName –cid = Request.Form(“CustID”) –cName=Request.Form(“CustName”) Cookies

ASP.NET Response Object This object allows you to send information back to client. It is created from the System.Web.HttpResponse class. Properties: –Cookies (a collection) Methods: –Response.Write –Response.Redirect (“URL”) Demo: testReqForm.htm, testReqForm.aspx

Downloading Internet Resources Download the HTML of a web page and display it in a text box. –System.URI A class for expressing a Uniform Resource Identifier. –System.Net.WebRequest Makes a request to a Uniform Resource Identifier. –WebResponse Provides a response from a Uniform Resource Identifier. Demo: MyBrowser/GetWebPage

Imports System.IO Imports System.Net Imports System.Text Private Sub BtnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnGo.Click Dim URI As New Uri(txtURL.Text) Dim request As WebRequest = WebRequest.Create(URI) Dim response As WebResponse = request.GetResponse Dim stream As Stream = response.GetResponseStream Dim readStream As New StreamReader(stream) Dim webData As String = readStream.ReadToEnd stream.Close() readStream.Close() txtData.Text = webData End sub

Change Downloaded Page For example, use string’s Replace method to change page content. –webData = webData.Replace("Chao", "You") Search/Replace with Regular Expression

Using the WebClient Class This class wraps the Request and Response classes. Methods: –DownloadData: Returns a byte array from an Internet address. –DownloadFile: Save a downloaded file. –OpenRead: Returns a stream from an Internet address.

UTFEncoding Class This class encodes Unicode characters using UCS Transformation Format, 8-bit form (UTF-8). This encoding supports all Unicode character Method: GetString –Decodes the specified byte array into a string.

WebClient/Download Dim wc As New WebClient() Dim utf8 As New UTF8Encoding() Dim webData As String webData = utf8.GetString(wc.DownloadData(txtURL.Text)) txtData.Text = webData

WebClient/DownloadFile.Save the dowloaded data directly in a file: Dim wc As New WebClient() wc.DownloadFile(txtURL.Text, "c:\testDownLoad.txt")

WebClient/OpenRead Dim wc As New WebClient() Dim stream As Stream stream = wc.OpenRead(txtURL.Text) Dim readStream As New StreamReader(stream) Dim webData As String = readStream.ReadToEnd txtData.Text = webData

Hosting Internet Explorer in Windows Forms Internet Explorer COM control –Right click Tool Box Windows Form tab and select Add/Remove Items …. –Select COM Component tab, and Scroll down to select Microsoft Web Browser.

Internet Explorer COM control Events –DownLoadComplete, DownLoadBegin Methods: –Navigate Dim HomeURL As String = " Private Sub MyBrowser_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load IE.Navigate(HomeURL) End Sub –Note: Navigate can take local file path as input to open a local page. –Goback, GoForward –Stop –Refresh2 –GoHome, GoSearch --- (Go to Microsoft home page and search engine)

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.

A Web Service Example ASPET/TestWebService.ASMX imports System.Web.Services imports System imports System.Data imports System.Data.Oledb Public Class CustomerInfo public Function GetCname(ByVal CID as String) as String dim strConn as string ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source = c:\sales2k.mdb" dim objConn as new OledbConnection(strConn) dim strSQL as string = "select * from customer where CID = '" & CID & "';" dim objComm as new OledbCommand(strSQL,objConn) dim Results as string objConn.open() dim objDataReader as oledbDataReader objDataReader=objComm.executeReader() objDataReader.read() return objDataReader("Cname") end function

Creating a Web Service Using VS New Project/ASP.Net Web Service

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 Windows Application Add a web reference to the web service. Declare a web service class variable. –Dim myWebService As New dchaolaptop.CustomerInfo() Demo: UseWebService

Universal Description, Discovery, and Integration (UDDI) A directory service for web services. –

Simple Mail Transport Protocol (SMTP) messages are text files. InetPub\MailRoot –PickUp directory: SMTP monitors this directory and sends any messages found in this directory. –Drop: Incoming messages received by SMTP are written to this directory. –BadMail: If an cannot be delivered or returned to the sender it is moved to this directory.

ASP.Net Classes SmtpMail class –System.Web.Mail –System.Web.Mail.MailMessage Methods: –Send(From, To, Subject, messageText) SmtpMail.Send(TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text) –Send(System.Web.Mail.MailMessage) Demo: –SendMail.aspx –Import system.web.mail

Using MailMessage Class to Set Properties properties: –Attachments –Bcc –Body –BodyFormat Text or Html –Cc –From –Headers –Subject –To

Using MailMessage with Attachment Dim objMsg As New MailMessage objMsg.From = TextBox1.Text objMsg.To = TextBox2.Text objMsg.Subject = TextBox3.Text objMsg.Body = TextBox4.Text Dim attachment As MailAttachment = New MailAttachment("c:\paradise.jpg") objMsg.Attachments.Add(attachment) Try SmtpMail.Send(objMsg) Catch ex As SystemException MessageBox.Show(ex.Message) End Try