Carnegie Mellon University MSCF1 C#/.NET Basics 2 Some code is from “C# in a Nutshell” and “Programming C#”

Slides:



Advertisements
Similar presentations
11 Getting Started with ASP.NET Beginning ASP.NET 4.0 in C# 2010 Chapters 5 and 6.
Advertisements

Web Forms and ASP.NET Programming Right from the Start with Visual Basic.NET 1/e 12.
11 ASP.NET Slides based off:. 22 B ACKGROUND - W EB A RCHITECTURE Web Server PC/Mac/Unix/... + Browser Client Server Request:
Internet Technologies 1 Master of Information System Management Java Server Faces Model/View/Controller Design Pattern for Web Development Slides.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 1.1 of…
Carnegie Mellon University MSCF 1.NET Distributed Computing Notes from “Distributed.NET Programming in C#” by Tom Barnaby and “.NET Programming” by Pradeep.
Web-Based Applications
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 3-1 of…
Carnegie Mellon University MSCF1 C#/.NET Basics 2 Some code is from “C# in a Nutshell” and “Programming C#”
INTRODUCTION TO WEB SERVICES CS 795. What is a Web Service ? Web service is a means by which computers talk to each other over the web using HTTP and.
SQL Reporting Services Overview SSRS includes all the development and management pieces necessary to publish end user reports in  HTML  PDF 
1 Web Services Visual C# 2008 Step by Step Chapter 30.
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.
ODBC and JDBC What are they – libraries of function calls that support SQL statements Why do we need them –Provide a way for an application to communicate.
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.
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.
Web Servers Web server software is a product that works with the operating system The server computer can run more than one software product such as .
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
A Scalable Application Architecture for composing News Portals on the Internet Serpil TOK, Zeki BAYRAM. Eastern MediterraneanUniversity Famagusta Famagusta.
JavaScript & jQuery the missing manual Chapter 11
Introduction to ASP.NET. Prehistory of ASP.NET Original Internet – text based WWW – static graphical content  HTML (client-side) Need for interactive.
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.
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.
Beginning Web Site Development Module 1 – Dynamic Web Site Development Fundamentals of building dynamic Web sites with ASP.NET 2.0 and C# Version.
London April 2005 London April 2005 Creating Eyeblaster Ads The Rich Media Platform The Rich Media Platform Eyeblaster.
Creating Web Applications Using ASP.NET Chapter Microsoft Visual Basic.NET: Reloaded 1.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
CSCI 6962: Server-side Design and Programming Introduction to Active Server Pages.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
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.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Programming with Visual Web Developer Chapter 9.
Internet Technologies and Web Application Web Services With ASP.NET Tutorial: Introduction to.
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
Carnegie Mellon University MSCF1 C#/.NET Basics 2 Some code is from “C# in a Nutshell”
Web Services. ASP.NET Web Services  Goals of ASP.NET Web services:  To enable cross-platform, cross- business computing  Great for “service” based.
Introducing ASP.NET 2.0. Internet Technologies WWW Architecture Web Server Client Server Request Response Network HTTP TCP/IP PC/Mac/Unix + Browser (IE,
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
Distributed Computing with HTTP, XML, SOAP, and WSDL CHAPTER 14 MOHAMMAD BORUJERDI 1 INTERNET ENGINEERING OUTLINE : Shift in perspective from data to programs.
XML Web Service. Overview of XML Web Service ASP.NET XML Web services enable you to remotely access the properties and methods of classes 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.
Web Access. Overview  Purpose  Prerequisites  Install Components  Enable Virtual Directories  IIS Configuration & Security  Troubleshooting.
ASP.NET Web Services.  A unit of managed code installed under IIS that can be remotely invoked using HTTP.
Module 9: Using XML Web Services in a C# Application.
Module 4: Creating a Web Application with Web Forms
Understanding Web Applications Lesson 4. Objective Domain Matrix Skills/ConceptsMTA Exam Objectives Understanding Web Page Development Understand Web.
1 10/19/05CS360 Windows Programming ASP.NET. 2 10/19/05CS360 Windows Programming ASP.NET  ASP.NET works on top of the HTTP protocol  Takes advantage.
.NET Mobile Application Development XML Web Services.
Overview of Previous Lesson(s) Over View  ASP is a technology that enables scripts in web pages to be executed by an Internet server.  ASP.NET is a.
Building Custom Controls with ASP.NET and the Microsoft ®.NET Framework Rames Gantanant Microsoft Regional Director, Thailand
ASP.NET WEB Applications. ASP.NET  Web application framework developed by Microsoft  Build dynamic data driven web applications and web services  Subset.
.Net training In gandhinagar 16/10/2016.
111 State Management Beginning ASP.NET in C# and VB Chapter 4 Pages
Section 10.1 Define scripting
Computing with C# and the .NET Framework
Computing with C# and the .NET Framework
INTRODUCTION TO WEB SERVICES CS 795. What is a Web Service ? Web service is a means by which computers talk to each other over the web using HTTP and.
Unit 27 - Web Server Scripting
Module 10: Creating a Web Application with Web Forms
Serpil TOK, Zeki BAYRAM. Eastern MediterraneanUniversity Famagusta
Web Development Using ASP .NET
Presentation transcript:

Carnegie Mellon University MSCF1 C#/.NET Basics 2 Some code is from “C# in a Nutshell” and “Programming C#”

Carnegie Mellon University MSCF2 This week Event Handling and delegates ASP.NET Web Forms ASP.NET Web Services

Carnegie Mellon University MSCF3 Event Handling Model Delegates listen for the events and call registered handlers Each component has a delegate for every event it can raise We register a method with the delegate and the delegate will call the method asynchronously

Carnegie Mellon University MSCF4 Delegates (1) A Button, for example, needs to notify some object when it is pushed We don’t want to hardwire (in the button) which object to call A delegate is a reference type used to encapsulate a method with particular parameter types

Carnegie Mellon University MSCF5 Delegate (2) using System; delegate String Foo(String x); // create a delegate class class Test { public static void Main() { Foo f = new Foo(ConvertToUpperCase); // create a delegate object String answer = f("abcd"); // call the method in the // object Console.WriteLine(answer); } public static String ConvertToUpperCase(String s) { return s.ToUpper(); }

Carnegie Mellon University MSCF6 Delegate (3) public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.Button multiplyButton; public void foo() { this.multiplyButton = new System.Windows.Forms.Button(); this.multiplyButton.Text = "Multiply"; this.multiplyButton.Click += new System.EventHandler(this.multiplyButton_Click); } private void multiplyButton_Click(object sender, System.EventArgs e) { textBox3.Clear(); string op1Str = op1.Text; string op2Str = op2.Text; : } Delegate reference Delegate Encapsulated method

Carnegie Mellon University MSCF7 Multicast Delegate using System; // From C# In A Nutshell delegate void MethodInvoker(); // define delegate class class Test { static void Main() { // create a Test object // and call its constructor new Test(); }

Carnegie Mellon University MSCF8 Test() { MethodInvoker m = null; m += new MethodInvoker(Foo); // overloaded += m += new MethodInvoker(Goo); // delegate holds m(); // pointers to two } // methods m MethodInvoker void Foo() void Goo()

Carnegie Mellon University MSCF9 void Foo() { Console.WriteLine("Foo"); } void Goo() { Console.WriteLine("Goo"); } Output: Foo Goo

Carnegie Mellon University MSCF10 ASP.NET Web Forms (1) Web Forms bring rapid appplication development to the web Similar technology is available on J2EE platforms (struts, Java Server Faces) Drag and drop development for the web tier – write event handlers as in Windows Forms User interacts with the sever via a standard browser

Carnegie Mellon University MSCF11 ASP.NET Web Forms (2) Web pages are dynamically generated Standard HTML is sent to the browser Notepad would work but Visual Studio makes life easy The user interface code is in an.aspx file The logic (C# code) is stored in a separate file (containing event handling code)

Carnegie Mellon University MSCF12 ASP.NET Web Forms (3) Postback events are handled on the server with an HTTP request. For example, the submit button is clicked. Non-postback events are not handled by the server immediately. For example, text is entered into a form or the mouse is moved. State is automatically added to an otherwise stateless protocol..NET maintains the user’s session.

Carnegie Mellon University MSCF13 Web Form Life Cycle Complicated series of activities similar to what is found in J2EE struts and JSF For this class let’s just say that a lot of pre- and post-processing goes on for each web request

Carnegie Mellon University MSCF14 Creating A Web Form(1) Prerequisites: IIS and Front Page Server Extensions (use Internet Service Manager and right click on the web site/All Tasks/Configure Server Extensions) Start/Microsoft Visual Studio.NET/ New Project/Visual C#/ASP.NET Web Application/BinomialTreeWebApp Generated code goes into c:\Inetpub\wwwroot\BinomialTreeWebApp

Carnegie Mellon University MSCF15 Creating A Web Form(2) Two files generated - The.aspx file holds the HTML - The aspx.cs file holds the C# To see the C# code right click the form and select view code Note that you can see the design view or the HTML view (tabs on bottom)

Carnegie Mellon University MSCF16 Web Services “The internet is evolving from a collection of isolated web sites and applications into a general communication bus for distributed applications.” Pradeep Tapadiya, author of “.NET Programming”

Carnegie Mellon University MSCF17 ASP.NET Web Services 0) Check if IIS is running by attempting to visit 1) If it's not running click Start/Settings/Control Panel/Add Remove Programs/ Add Remove Windows Components and enable IIS. 2) If.NET was installed after IIS reconfigure IIS by running aspnet_regiis.exe /i from a command prompt.

Carnegie Mellon University MSCF18 ASP.NET Web Services Suppose we want to provide a student name given a student ID.

Carnegie Mellon University MSCF19 ASP.NET Server Code // CoolService.asmx using System.Web.Services; using System.Collections; namespace Student { [WebService(Namespace=" public class QueryService : WebService { private static Hashtable nameValuePairs;

Carnegie Mellon University MSCF20 static QueryService() { nameValuePairs = new Hashtable(); nameValuePairs.Add("12345","Moe"); nameValuePairs.Add("01234","Curly Joe"); nameValuePairs.Add("54321","Larry"); } [WebMethod] public string GetName(string id) { return (string)nameValuePairs[id]; }

Carnegie Mellon University MSCF21 Create a virtual directory under IIS Start Settings Control Panel Administrative Tools Select Internet Information Services Expand and select the default web site Click Action/New/Virtual Directory Provide a name (ACoolQueryService in this case) and browse to the directory holding the.asmx file Select everything but write

Carnegie Mellon University MSCF22 Checking the service Visit the service with your browser HTML is generated that allows you to test the service via standard HTTP

Carnegie Mellon University MSCF23 Testing With HTTP Get Request GET /ACoolQueryService/CoolService.asmx/GetName?id=string HTTP/1.1 Host: localhost HTTP/ OK Content-Type: text/xml; charset=utf-8 Content-Length: length Response string

Carnegie Mellon University MSCF24 Testing with SOAP POST /ACoolQueryService/CoolService.asmx HTTP/1.1 Host: localhost Content-Type: text/xml; charset=utf-8 Content-Length: length of document SOAPAction: " <soap:Envelope xmlns:xsi=" instance" xmlns:xsd=" xmlns:soap="

Carnegie Mellon University MSCF25 string

Carnegie Mellon University MSCF26 SOAP Response HTTP/ OK Content-Type: text/xml; charset=utf-8 Content-Length: length <soap:Envelope xmlns:xsi=" xmlns:xsd=" xmlns:soap="

Carnegie Mellon University MSCF27 <GetNameResponse xmlns= " string