8. Web-based Apps in.NET. 2 Microsoft Objectives “Real-world applications are typically multi-tier, distributed designs involving many components — the.

Slides:



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

ASP.NET Ajax Supplementary Tutorial. Why Use ASP.NET AJAX? - I ASP.NET AJAX enables you to build rich Web applications that have many advantages over.
Designing, Deploying and Managing Workflow in SharePoint Sites Steve Heaney Product Development Manager OBS
Presentation 10 SOAP on the Microsoft Platform (.NET)
Apache Struts Technology
11 Getting Started with ASP.NET Beginning ASP.NET 4.0 in C# 2010 Chapters 5 and 6.
Web Forms and ASP.NET Programming Right from the Start with Visual Basic.NET 1/e 12.
DT211/3 Internet Application Development Active Server Pages & IIS Web server.
Web Development in Microsoft Visual Studio Slide 2 Lecture Overview Introduce Visual Studio 2013 Create a first ASP.NET application.
1 Chapter 12 Working With Access 2000 on the Internet.
ASP Tutorial. What is ASP? ASP (Active Server Pages) is a Microsoft technology that enables you to make dynamic and interactive web pages. –ASP usually.
Session 6 Server-side programming - ASP. An ASP page is an HTML page interspersed with server-side code. The.ASP extension instead of.HTM denotes server-side.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
Web-Based Applications
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College Lecture 8: WebForms — Web-based.
12. WebForms: Web-based GUIs in.NET. 2 Visual Studio.NET Objectives “Drag-and-drop GUI construction has long been the norm for Windows development. With.
1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB.
Introduction to.Net and ASP.Net Course Introduction Build Your Own ASP.Net Website: Chapter 1 Microsoft ASP.Net Walkthrough: Creating a Basic Web Forms.
9-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
CIS 375—Web App Dev II ASP.NET 2 Introducing Web Forms.
Introduction to ASP.NET. Prehistory of ASP.NET Original Internet – text based WWW – static graphical content  HTML (client-side) Need for interactive.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
Data-Enabled Web Sites: Classibooks.com & Internet Database Technologies Colin Fukai April 4, 2000 Gonzaga University.
3/8/00asp00 1 Active Server Pages from Microsoft Nancy McCracken Northeast Parallel Architectures Center at Syracuse.
.Net is a collection of libraries, templates and services designed to make programming applications of all kinds, easier, more flexible (multi platform),
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott COMP6325 Advanced Web Technologies Dr. Paul Walcott The University.
Beginning Web Site Development Module 1 – Dynamic Web Site Development Fundamentals of building dynamic Web sites with ASP.NET 2.0 and C# Version.
Creating Web Applications Using ASP.NET Chapter Microsoft Visual Basic.NET: Reloaded 1.
ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Digital.
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.
ASP Introduction Y.-H. Chen International College Ming-Chuan University Fall, 2004.
The Web Architecture and ASP.NET. Slide 2 Review of the Web (1) It began with HTTP and HTML, which delivers static Web pages to browsers which would render.
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
Lecture Note 1: Getting Started With ASP.  Introduction to ASP  Introduction to ASP An ASP file can contain text, HTML tags and scripts. Scripts in.
ASP.NET The Clock Project. The ASP.NET Clock Project The ASP.NET Clock Project is the topic of Chapter 23. By completing the clock project, you will learn.
Are you getting the benefits from ASP.NET and AJAX? Introduction to the CTC ASP.NET Webforms Generator.
Introducing ASP.NET 2.0. Internet Technologies WWW Architecture Web Server Client Server Request Response Network HTTP TCP/IP PC/Mac/Unix + Browser (IE,
Database Handling, Sessions, and AJAX. Post Back ASP.NET Functionality The IsPostBack method in ASP.NET is similar to the BlackBerry.refresh method –IsPostBack.
Web Development in Microsoft Visual Studio Slide 2 Lecture Overview How to create a first ASP.NET application.
C# GUI - Basics. Objectives.NET supports two types: WinForms, traditional, desktop GUI apps. WebForms – newer, for Web apps. Visual Studio.NET supports.
VITALE, CATURANO & COMPANY LTD Microsoft SharePoint Web Part Development Overview VITALE, CATURANO & COMPANY LTD SharePoint Developer Series – Web Part.
ASP (Active Server Pages) by Bülent & Resul. Presentation Outline Introduction What is an ASP file? How does ASP work? What can ASP do? Differences Between.
The Problem of State. We will look at… Sometimes web development is just plain weird! Internet / World Wide Web Aspects of their operation The role of.
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.
BlackBerry Applications using Microsoft Visual Studio and Database Handling.
ASP.NET (Active Server Page) SNU OOPSLA Lab. October 2005.
ASP. ASP is a powerful tool for making dynamic and interactive Web pages An ASP file can contain text, HTML tags and scripts. Scripts in an ASP file are.
Introduction to ASP.NET development. Background ASP released in 1996 ASP supported for a minimum 10 years from Windows 8 release ASP.Net 1.0 released.
 Lecture  Website language: ASP.net  Book name Beginning ASP.NET 4 in C# and VB 2.
A S P. Outline  The introduction of ASP  Why we choose ASP  How ASP works  Basic syntax rule of ASP  ASP’S object model  Limitations of ASP  Summary.
ASP – Web Programming Class  Ravi Anand. ASP – Active Server Pages What is ASP? - Microsoft Technology - Can Run using IIS/PWS/Others - Helps us create.
Web Forms, HTML, and ASP.NET
Introduction to ASP By “FlyingBono” 2009_01 By FlyingBono 2009_01
Haritha Dasari Josue Balandrano Coronel -
Active Server Pages ASP.Net
Unit 27 - Web Server Scripting
Web Development in Microsoft Visual Studio 2013
Web Development Using ASP .NET
ASP.NET
ASP.NET Module Subtitle.
6. WinForms 2003 C# GUI - Basics.
0. Overview of 2-Day Academic .NET Workshop
Presentation transcript:

8. Web-based Apps in.NET

2 Microsoft Objectives “Real-world applications are typically multi-tier, distributed designs involving many components — the web server being perhaps the most important component in today's applications...” Web-based applications IIS WebForms

3 Microsoft Part 1 Web-based applications…

4 Microsoft Application design Many applications are designed with N levels or "tiers" –good separation of concerns –enables reuse of back-end tiers across varying FEs Front-end object BusinessPresentationData AccessData

5 Microsoft Web-based applications Web-based apps offer many advantages: –extend reach of application to people AND platform –based on open, non-proprietary technologies Two types: –WebForms :GUI-based app displayed in browser –WebServices :object-based app returning raw XML obj browser Web server HTTP, HTML Web Page obj custom FE other App SOAP, XML

6 Microsoft Part 2 IIS…

7 Microsoft Internet Information Services (IIS) IIS is Microsoft's Web Server –runs as a separate process "inetinfo.exe" –requires a server-like OS: Windows NT, 2000, XP Pro –multi-threaded to service thousands of requests… Windows Server IIS client......

8 Microsoft Configuring IIS Configured manually via: –control panel, admin tools, Internet Information Services

9 Microsoft A web site IIS deals with web sites A web site = a web application How IIS works: –each web site has its own physical directory on hard disk –each web site is assigned a virtual name for that directory –users surf to web site based on virtual name Example: –web site lives in C:\Inetpub\wwwroot\WebSite –web site's virtual name is "AAAPainting" –IIS maps virtual to physical…

10 Microsoft Creating a virtual directory When in doubt, right-click :-) –right-click on "Default Web Site", New, Virtual Directory…

11 Microsoft Types of web sites From IIS's perspective, 2 types: –static –dynamic

12 Microsoft Static web sites A static web site has the following characteristics: 1.all web pages are pre-created and sitting on hard disk 2.web server returns pages without any processing Welcome to AAA Painting Welcome to AAA Painting History of our company Pricing How to contact us

13 Microsoft HTML Static web sites are typically pure HTML –pages may also contain script code that runs on client-side Welcome to AAA Painting Welcome to AAA Painting History of our company Pricing How to contact us

14 Microsoft Dynamic web sites A dynamic web site involves server-side processing How does IIS tell the difference? –based on file extension of requested web page… Example: –static request: –dynamic request:

15 Microsoft ASP Active Server Pages Microsoft's server-side programming technology –ASP based on scripting languages, interpreted –ASP.NET based on.NET languages, compiled, faster, … IIS client ASP engine HTML

16 Microsoft Example We want to dynamically create web page of attendee's –i.e. generate the page by reading names from a database IIS ASP Page

17 Microsoft ASP page — part 1, presentation ASP page = HTML + code… RWWP.NET, July 2002 RWWP.NET, July 2002 List of attendees: <% Call OutputAttendees( ) %> Sub OutputAttendees(). inline code block default.asp

18 Microsoft ASP page — part 2, logic Sub OutputAttendees() Dim dbConn, rs, sql, firstName, lastName sql = "Select * From Attendees" Set dbConn = CreateObject("ADODB.Connection") Set rs = CreateObject("ADODB.RecordSet") dbConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;" + _ "Data Source=C:\Inetpub\wwwroot\Workshop\Attendees.mdb") rs.ActiveConnection = dbConn : rs.Source = sql : rs.Open Do While Not rs.EOF firstName = rs("FirstName") lastName = rs("LastName") Response.Write(" " + firstName + " " + lastName) rs.MoveNext() Loop rs.Close : dbConn.Close End Sub default.asp

19 Microsoft The key to web programming… It's a client-server relationship –client makes request –server does some processing… –client sees OUTPUT of server-side processing

20 Microsoft Part 3 WebForms…

21 Microsoft Traditional form-based web apps HTML already supports the creation of form-based apps Login Please login: Username: Password:

22 Microsoft WebForms Web-based, form-based.NET apps Based on many technologies: –IIS –ASP.NET (extension to IIS) –.NET Framework SDK (CLR, FCL, tools) –Visual Studio.NET (drag-and-drop creation)

23 Microsoft Abstraction Like WinForms, WebForms are based on classes in FCL –separates WebForm app from underlying platform System.Web.UI.Page CLR Windows OS instance of FCL class object

24 Microsoft Creating a WebForm app Good news: much like creating a WinForm app! 1.create appropriate project in Visual Studio 2.design form(s) via drag-and-drop of controls 3.program events

25 Microsoft Example A simple WebForms app to view attendee info from DB

26 Microsoft (1) Create ASP.NET Web App project Location = name of web site = " –virtual directory:AttendeeApp –physical directory:C:\Inetpub\wwwroot\AttendeeApp

27 Microsoft (2) Project layout VS.NET configures IIS for you VS.NET creates web site for you –contains 1 form-based web page –named WebForm1.aspx by default –ignore other files for now…

28 Microsoft (3) Design WebForm Just like a WinForm –drag-and-drop from toolbox…

29 Microsoft Web controls vs. HTML controls Toolbox contains 2 types of controls: –those under Web Forms –those under HTML Both generate pure HTML on client –though sometimes with JavaScript! Web controls: –work like WinForm counterparts HTML controls: –mimic standard HTML controls

30 Microsoft (4) Implement events WebForms are event-driven, as you would expect: –on Page_Load, fill list box from database –on cmdViewInfo_Click, display info about selected attendee In each case, standard C# database programming… private void Page_Load(...) { IDbConnection dbConn = null; try { dbConn = new OleDbConnection(sConnection); dbConn.Open();.

31 Microsoft (5) Run! You can run from within VS You can debug from within VS How does it work? –starts up a session of IE –attaches debugger to IIS –displays.aspx page marked as "Start Page" in your project right-click on.aspx page you want to start with select "Set as Start Page"

32 Microsoft (6) Reminder — client-server relationship! The server contains lots of code –see physical directory… But the client sees only HTML! –"View Source" in browser…

33 Microsoft ASP.NET programming model On the surface WebForms appear like WinForms But the programming model is different underneath –due to ASP.NET –due to client-server paradigm

34 Microsoft #1: Traditional dialog doesn't work For example, these do not work: –MessageBox.Show( ) –form1.Show( ) Why not? –think about where form would appear… Solutions: –if you want to tell user something, display via label on page –if you want to show another page, redirect browser

35 Microsoft Web-based dialogs To display a message to user: private void cmdViewInfo_Click(...) { if (this.ListBox1.SelectedItem == null) { // nothing selected this.lblErrorMsg.Text = "Please select an attendee!"; return; }.

36 Microsoft #2: Fewer events There are fewer events to program in WebForms –primarily Change and Click events only Why? –because each event represents 1 round-trip to server for processing –and thus event processing represents a very expensive activity IIS client 1. initial request is posted 2. HTML rendering of page 3. same page is "posted- back" for event processing 4. HTML rendering of page ASP.NET engine

37 Microsoft #3: AutoPostBack In fact, some events aren't posted right away… –instead event is "queued" until page is eventually posted back To force immediate postback? –set control's AutoPostBack property (if it has one) Example: –list box doesn't postback when you click on an item –instead, event is queued until later (e.g. button is clicked)

38 Microsoft #4: Postbacks There is a distinction made between: –first request that is posted to server for page X by client C –subsequent "postbacks" of page X to client C Example: –Page_Load event triggers every time –but typically only need to initialize form the first time! private void Page_Load(...) { if (this.IsPostBack) // no need to reload list box! return;.. // first request, load list box from DB.

39 Microsoft #5: Statelessness Web apps are stateless Each page request is a self-contained operation: connection is opened request is posted result is returned connection is closed Implications? By default: –no session state (i.e. no data for client C across pages) –no global state (i.e. no data across all clients & pages) –postback state *is* maintained for you by.NET e.g. contents of list box

40 Microsoft Summary Web-based applications are commonplace Web-based applications are often mission-critical Two options: –WebForms: form-based –WebServices: object-based WebForms make Web-based apps far easier to build…

41 Microsoft References Books: –F. Onion, "Essential ASP.NET" –D. Sussman et al., "Beginning ASP.NET 1.0 with C#" Web sites: – –

42 Microsoft Lab? Work on lab #5, "WebForms"…