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.

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

Introduction to ASP.Net ISYS 512. ASP.NET ASP.NET is a server-side technology for creating dynamic web pages. ASP.NET allows you to use a selection of.
JavaScript Forms Form Validation Cookies CGI Programs.
Forms Review. 2 Using Forms tag  Contains the form elements on a web page  Container tag tag  Configures a variety of form elements including text.
Web Basics ISYS546. Basic Tools Web server –Default directory, default home page –Virtual directory Web page editor –Front Page Web page languages –HTML,
Introduction to ASP.Net
Introduction to ASP.Net ISYS 512/812. Web Server Web Server: –Internet Information Service: ControlPanel/AdministrativeTools/Internet Information Services.
1 Active Server Pages Active Server Pages (ASPs) are Web pages ASP = server-side scripts + HTML The appearance of an Active Server Page depends on who.
Introduction to Web Application Development with.Net and Web Service ISYS 350.
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.
USER INTERACTIONS: FORMS
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.
Server-Side Scripting with ASP.Net ISYS 546. Dynamic Page – Client-Side Script Example Demo: TimeNowClient.Htm New Page 1 The time is now document.write.
1 Chapter 20 — Creating Web Projects Microsoft Visual Basic.NET, Introduction to Programming.
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.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
Chapter 10 Form Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
11 ASP.NET Controls Beginning ASP.NET 4.0 in C# 2010 Chapter 6.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
ASP.NET Programming with C# and SQL Server First Edition
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.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott COMP6325 Advanced Web Technologies Dr. Paul Walcott The University.
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
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.
CSC 2720 Building Web Applications HTML Forms. Introduction  HTML forms are used to collect user input.  The collected input is typically sent to a.
ASP.NET.. ASP.NET Environment ASP.NET is Microsoft's programming framework that enables the development of Web applications and services. It is an easy.
Chapter 8 Cookies And Security JavaScript, Third Edition.
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
CIS 451: ASP.NET Objects Dr. Ralph D. Westfall January, 2009.
Website Development with PHP and MySQL Saving Data.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
Week 9 - Form Basics Key Concepts 1. 1.Describe common uses of forms on web pages 2.Create forms on web pages using the form, input, textarea, and select.
HTML FORMS GET/POST METHODS. HTML FORMS HTML Forms HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes,
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.
XHTML & Forms. PHP and the WWW PHP and HTML forms – Forms are the main way users can interact with your PHP scrip Typical usage of the form tag in HTML.
Module 4: Creating a Microsoft ASP.NET Web Form. Overview Creating Web Forms Using Server Controls.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 9 Key Concepts 1 Copyright © Terry Felke-Morris.
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.
Week Developing Web Applications 12. Programming for the Web A Web Application Runs on a Web Server and Presents Its Content to the User Across a Network,
ASP.Net, Web Forms and Web Controls 1 Outline Session Tracking Cookies Session Tracking with HttpSessionState.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Bookstore Application: Middle Tier Introducing Code-Behind Files, Session State.
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.
CIS 451: Cookies Dr. Ralph D. Westfall February, 2009.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 9 Key Concepts 1 Copyright © Terry Felke-Morris.
©SoftMooreSlide 1 Introduction to HTML: Forms ©SoftMooreSlide 2 Forms Forms provide a simple mechanism for collecting user data and submitting it to.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Web Page Introduction. What is a web page? A hypertext is a document contains clickable links. A web page is a text file containing Hyper Text MarkUp.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
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
Lecture 6 Sara Almudauh ASP.NET Part 1 Development of Internet Application 1501CT - Sara Almudauh.
Computing with C# and the .NET Framework
ASP.NET Forms.
ASP.NET Web Controls.
Active Server Pages ASP.Net
ASP.Net Demo ISYS 350.
Static and Dynamic Web Pages
ASP.NET.
Web Form Introduction.
Presentation transcript:

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 an ASP.NET page, it is sent to the Common Language Runtime for compilation and execution. 4. The HTML produced by the CLR is returned to the browser.

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 Server Web Server: –VS Built-in Web Server VS 08 uses the built-in web server for debugging. Default home page –Default.aspx, default.asp, default.htm ASP.Net project directory Note: Using the Built-In web server, a web project can be created in any folders.

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.

Request Object Properties 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 ClientCertificates Path, ApplicationPath, PhysicalApplicationPath, etc.

ASP.NET Response Object This object allows you to send information back to client. It is created from the System.Web.HttpResponse class. Properties: –Buffer –Cookies (a collection) Methods: –Response.Write (“…..”) *** MessageBox is not available for web project ***. –Response.Clear(), Response.Flush(): clear/flush buffer –Response.Redirect (“URL”)

Web Project New Project: –C#/Web/Asp.Net Empty Web Application Add a Web form: –Project/Add new item/web form A web form contains: –A design file: Ex. webform.aspx Design view and source (HTML) view –A CodeBehind file: webform1.aspx.cs To set start up page: –Point to the web page in the Solution Explorer and right click to choose Set As Start Page.

Two Types of Form HTML Form with HTML controls: EnterCID: ASP.Net Web Form with server-side controls: <asp:TextBox ID="TextBox2" runat="server" style="position: absolute; top: 39px; left: 164px; z- index: 1">

Create an ASP.Net Web Form to add two numbers Add controls: –Web form flow layout: Controls are positioned from left to right and from top to bottom. –To change a control’s position : Format/Set position –Absolute –Relative –Note: We can use a table to format a form in flow layout: –Table/Insert table –Add controls in the table Add code: –Double-click the form to open the code view. –Events: Page_Load event and control’s events

Elements of an ASP.Net Page Design page: with file extension aspx –Contains: Directives ASP.Net controls HTML tags Code-behind file: with file extension aspx.cs or aspx.vb

Directives A directive controls how an ASP.Net page is compiled. –Page directives: Specify default language, enable tracing and debugging for a page. –, –Imports name spaces –To process Access database, we need to import: –

GridView Creating bound DataGrid by dragging a table from the Server Explorer Smart tag: –Configure Data Source –Enable: Paging Soring Deleting/Editing

Work with Multiple Pages Add a new form Add an existing form or page Change the starting web form Redirect or transfer to another page: –Server.Transfer("WebForm2.aspx"); –Or, Response.Redirect("WebForm2.aspx"); –Or, ImageButton PostBackURL property

HTML Introduction Heading section –,,,, etc. Body section –,, to,, –Formatting:,,, –Comment: –List –Image –Table:, : a new row in table, : a new cell in a table row. –Form:,,, – : defines a division or a section in an HTML document. tag is often used to group block-elements to format them with styles.

META Tag The meta tag allows you to provide additional information about the page that is not visible in the browser: – Redirection: – “3” is number of seconds.

TABLE Tag

HTML 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 Demo: TestFormGet.Htm, TestFormPost.Htm

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:

Creating a QueryString Entered with a URL: – As part of a URL specified in an anchor tag. – Via a form sent to the server with the GET method. Created by script

Input Tag HTML textbox, radiobutton, checkbox, button, listbox, etc.

ASP.Net Inline Coding Example The time is now <% dim iHour as Double iHour=Now.Hour() if iHour < 12 then response.write(" good morning ") else response.write (" good afternoon ") end if %>

A HTML Form submitted using the Get method and is handled by an ASP.Net page Demo: –testFormGet.htm –testFormGet.aspx

testFormGet.htm EnterCID: EnterName:

testFormGet.aspx <% response.write(" " & request.queryString("cid")& " ") response.write (" " & request.queryString("cname")& " ") %>

A HTML Form submitted using the Post method and is handled by an ASP.Net page Demo: –testFormPost.htm –testFormPost.aspx

testFormPost.htm EnterCID: EnterName:

testFormPost.aspx <% response.write (" cid=" & request.form("cid") & " ") response.write (" cname=" & request.form("cname")& " ") %>

Other ASP.NET Request Object Properties Demo Demo: –testRequest.Htm –TestRequest.aspx

testRequest.htm EnterCID: EnterName:

<% response.write (" cid=" & request.form("cid") & " ") response.write (" cname=" & request.form("cname")& " ") Response.Write(" filepath " & Request.FilePath & " ") Response.Write(" httpMethod " & Request.HttpMethod & " ") Response.Write(" path " & Request.Path & " ") Response.Write(" Url " & Request.Url.ToString & " ") Response.Write(" urlReferer " & Request.UrlReferrer.ToString & " ") Response.Write(" HostName " & Request.UserHostName & " ") Response.Write(" HostAddress " & Request.UserHostAddress & " ")%> testRequest.aspx

Demo other HTML controls: TestReqForm EnterCID: EnterName: checkbox1 checkbox 2 radio1 radio 2 A B C listbox

TestReqForm.Aspx <% response.write (" cid=" & request.form("cid") & " ") response.write (" cname=" & request.form("cname")& " ") response.write (" hidden variable=" & request.form("hidden1")& " ") if request.form("C1")="ON" then response.write (" You select checkbox 1 ") end if if request.form("C2")="ON" then response.write (" You select checkbox 2 ") end if if request.form("R1")="V1" then response.write (" You select Radio 1 ") else response.write (" You select Radio 2 ") end if response.write (" listBox=" & request.form("D1")& " ") response.write (" " & request.queryString("myquery")& " ") %>

Buffer When ASP.Net is running the code, it gradually builds up the HTML that will be sent back to the browser. As the HTML is generated, it is placed in a buffer. Normally, the HTML is held in the buffer so that it isn’t sent to the browser until the page finishes executing. Response.Buffer: The default value for this property is true which means the page is buffered and sent in one block. –Response.Buffer=Falsesends html as it is generated.

The Application and Session Objects Application state: A central, site-wide store of variables that we can get from any page. –System.Web.HttpApplication A session is a single visit to a web site, and normally includes visits to a number of pages. Each time a visitor comes to your web site, a session object is created for the visitor. Session state is a store of variables that relates to a session. –System.Web.SessionState

Examples of Using the Application and Session Objects Examples of session variables are: user’s id, user’s name, Shopping cart, etc. Examples of application variables are: visitor counter.

Working with the Application and Session To place a value into the Application and Session simply assign it a key and then assign the value: –Application[“CustName”]=“Smith”; –Session [“Age”]=25; To read values from the Application and Session: –Cname=Application[“Name”].ToString(); –myAge = Session[“Age”].ToString(); To remove an item, or all items: Remove, RemoveAll() –Application.Remove[“Name”]; –Session.RemoveAll();