Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
dotNET_Overview.pdf
1. Introduction to the Web
and .NET
This material is based on the original slides of Dr. Mark Sapossnek, Computer Science Department,
Boston University, Mosh Teitelbaum, evoch, LLC, and Joe Hummel, Lake Forest College
3. Internet Technologies
The World Wide Web
◆ A way to access and share information
■ Technical papers, marketing materials, recipes, ...
◆ A huge network of computers: the Internet
◆ Graphical, not just textual
◆ Information is linked to other information
◆ Application development platform
■ Shop from home
■ Provide self-help applications for customers and
partners
■ ...
5. Internet Technologies
WWW Architecture
◆ Client/Server, Request/Response architecture
■ You request a Web page
• e.g. http://www.msn.com/default.asp
• HTTP request
■ The Web server responds with data in the form of a Web page
• HTTP response
• Web page is expressed as HTML
■ Pages are identified as a Uniform Resource Locator (URL)
• Protocol: http
• Web server: www.msn.com
• Web page: default.asp
• Can also provide parameters: ?name=Keith
6. Internet Technologies
Web Standards
◆ Internet Engineering Task Force (IETF)
■ http://www.ietf.org/
■ Founded 1986
■ Request For Comments (RFC) at
http://www.ietf.org/rfc.html
◆ World Wide Web Consortium (W3C)
■ http://www.w3.org
■ Founded 1994 by Tim Berners-Lee
■ Publishes technical reports and recommendations
7. Internet Technologies
Hypertext Markup Language (HTML)
◆ The markup language used to represent
Web pages for viewing by people
■ Designed to display data, not store/transfer data
◆ Rendered and viewed in a Web browser
◆ Can contain links to images, documents,
and other pages
◆ Not extensible
◆ Derived from Standard Generalized Markup
Language (SGML)
◆ HTML 3.2, 4.01, XHTML 1.0, HTML5
8. Internet Technologies
HTML Forms
◆ Enables you to create interactive
user interface elements
■ Buttons
■ Text boxes
■ Drop down lists
■ Check boxes
◆ User fills out the form and submits it
◆ Form data is sent to the Web server via HTTP
when the form is submitted
9. Internet Technologies
Hypertext Transport Protocol (HTTP)
◆ The top-level protocol used to request and
return data
■ E.g. HTML pages, GIFs, JPEGs, Microsoft Word
documents, Adobe PDF documents, etc.
◆ Request/Response protocol
◆ Methods: GET, POST, …
◆ HTTP 1.0: simple
◆ HTTP 1.1: more complex
10. Method File HTTP version Headers
GET /default.asp HTTP/1.0
Accept: image/gif, image/x-bitmap, image/jpeg, */*
Accept-Language: en
User-Agent: Mozilla/1.22 (compatible; MSIE 2.0; Windows 95)
Connection: Keep-Alive
If-Modified-Since: Sunday, 17-Apr-96 04:32:58 GMT
Blank line
Data – none for GET
Internet Technologies
HTTP Request
11. HTTP/1.0 200 OK
Date: Sun, 21 Apr 1996 02:20:42 GMT
Server: Microsoft-Internet-Information-Server/5.0
Connection: keep-alive
Content-Type: text/html
Last-Modified: Thu, 18 Apr 1996 17:39:05 GMT
Content-Length: 2543
<HTML> Some data... blah, blah, blah </HTML>
Internet Technologies
HTTP Response
HTTP version Status code Reason phrase Headers
Data
12. Internet Technologies
HTTP Server Status Codes
Code Description
200 OK
201 Created
301 Moved Permanently
302 Moved Temporarily
400 Bad Request – not understood
401 Unauthorized
403 Forbidden – not authorized
404 Not Found
500 Internal Server Error
13. Internet Technologies
HTTP
◆ HTTP is a stateless protocol
◆ Each HTTP request is independent of previous
and subsequent requests
◆ Statelessness has a big impact on how scalable
applications are designed
14. Internet Technologies
Cookies
◆ A mechanism to store a small amount of
information (up to 4KB) on the client
◆ A cookie is associated with a specific web site
◆ Cookie is sent in HTTP header
◆ Cookie is sent with each HTTP request
◆ Can last for only one session (until browser is
closed) or can persist across sessions
◆ Can expire some time in the future
15. Internet Technologies
HTTPS
◆ A secure version of HTTP
◆ Allows client and server to exchange data with
confidence that the data was neither modified
nor intercepted
◆ Uses Secure Sockets Layer (SSL)/
Transport Layer Security (TLS)
16. Internet Technologies
URIs, URLs and URNs
◆ Uniform Resource Identifier (URI = URL or URN)
■ Generic term for all textual names/addresses
◆ Uniform Resource Locator (URL)
■ The set of URI schemes that have explicit instructions
on how to access the resource over the Internet,
e.g. http, ftp, gopher
◆ Uniform Resource Name (URN)
1)A URI that has an institutional commitment to
availability, etc.
2) A particular scheme intended to identify resources
e.g. urn:schemas:httpmail:subject
17. Internet Technologies
Multipurpose Internet Mail Extensions (MIME)
◆ Defines types of data/documents
■ text/plain
■ text/html
■ image/gif
■ image/jpeg
■ audio/x-pn-realaudio
■ audio/x-ms-wma
■ video/x-ms-asf
■ application/octet-stream
18. Internet Technologies
MIME
◆ Specifies character sets, e.g. ASCII
◆ Supports multi-part messages
◆ Originally designed for email, but also used in
other places, such as HTTP
19. Internet Technologies
Networks - Application Layer
◆ Telnet: Remote sessions
◆ File Transfer Protocol (FTP)
◆ Network News Transfer Protocol (NNTP)
◆ Simple Network Management Protocol (SNMP)
◆ Simple Mail Transfer Protocol (SMTP)
◆ Post Office Protocol (POP3)
◆ Interactive Mail Access Protocol (IMAP)
20. Internet Technologies
Extensible Markup Language (XML)
◆ Represents hierarchical data
◆ A meta-language: a language for defining
other languages
◆ Extensible
◆ Useful for data exchange and transformation
◆ Simplified version of SGML
22. .NET Overview
◆ Introduction to .NET
◆ Web Services
◆ The .NET Framework
◆ Common Language Runtime
◆ Windows Forms
◆ Web Forms
◆ ADO.NET
◆ Languages
23. Introduction to .NET
What is .NET?
◆ A vision of how information technology
will evolve
◆ A platform that supports the vision
◆ A business model of software as a service
24. Introduction to .NET
What is .NET?
◆ A vision
■ Web sites will be joined by Web services
■ New smart devices will join the PC
■ User interfaces will become more adaptable
and customizable
■ Enabled by Web standards
25. ◆ A platform
■ The .NET Framework
■ Visual Studio.NET
■ .NET Enterprise Servers
• Database, Messaging, Integration,
Commerce, Proxy, Security, Mobility,
Content Management
■ .NET Web Services as Building Blocks
■ Goal: make it incredibly easy to build powerful Web
applications and Web services
Introduction to .NET
What is .NET?
26. Introduction to .NET
What is .NET?
◆ A business model
■ Software as a service
■ Subscription-based services
■ Application hosting, e.g. bCentral
27. Introduction to .NET
The .NET Platform
Web Form Web Service
.NET Framework
Windows
.NET Foundation
Web Services
Your Internal
Web Service
Third-Party
Web Services
.NET Enterprise
Servers
Clients Applications
Protocols: HTTP,
HTML, XML,
SOAP, UDDI
Tools:
Visual Studio.NET,
Notepad
28. Web Services
◆ A programmable application component
accessible via standard Web protocols
◆ The center of the .NET architecture
◆ Exposes functionality over the Web
◆ Built on existing and emerging standards
■ HTTP, XML, JSON, REST, SOAP, UDDI, WSDL, …
29. Web Services
Evolution of the Web
Generation 1
Static HTML
HTML
Generation 2
Web Applications
HTML
HTML, XML
HTML, XML
Generation 3
Web Services
30. The .NET Framework
What Is the .NET Framework?
◆ A set of technologies for developing and using
components to create:
■ Web Forms
■ Web Services
■ Windows Applications
◆ Supports the software lifecycle
■ Development
■ Debugging
■ Deployment
■ Maintenance
31. Common Language Runtime
ASP.NET: Web Services
and Web Forms
VB C++ C# JScript …
Common Language Specification
Windows
Forms
.NET Framework Base Classes
ADO.NET: Data and XML
Visual
Studio.NET
The .NET Framework
The .NET Framework and Visual Studio.NET
33. Common Language Runtime
Goals
◆ Development services
■ Deep cross-language interoperability
■ Increased productivity
◆ Deployment services
■ Simple, reliable deployment
■ Fewer versioning problems – NO MORE ‘DLL HELL’
◆ Run-time services
■ Performance
■ Scalability
■ Availability
▪ Reliability
▪ Security
▪ Safety
34. Source Code
C++, C#, VB or any
.NET language
Compiler
csc.exe or vbc.exe
Assembly
DLL or EXE
Common Language Runtime
Compilation
35. ◆ Assembly
■ Logical unit of deployment
■ Contains Manifest, Metadata, MSIL and resources
◆ Manifest
■ Metadata about the components in an assembly
(version, types, dependencies, etc.)
◆ Type Metadata
■ Completely describes all types defined in
an assembly: properties, methods, arguments,
return values, attributes, base classes, …
Common Language Runtime
Assemblies
36. Common Language Runtime
Assemblies
◆ Microsoft Intermediate Language (MSIL, IL)
■ All languages compile to IL (managed code)
■ IL is always compiled to native code before
being executed
◆ Resources
■ E.g. .bmp, .jpg
37. Common Language Runtime
Execution Model
CLR
VB
Source
code
Compiler
C++
C#
Assembly Assembly
Assembly
Operating System Services
MSIL
Common Language Runtime JIT Compiler
Compiler Compiler
Native
code
Managed
Code
Managed
Code
Managed
Code
Unmanaged
Code
CLR Services
Ngen
38. Assemblies
◆ 1 assembly = 1 or more compiled classes
■ .EXE represents an assembly with classes + Main program
■ .DLL represents an assembly with classes
Development Tools
assembly
code.vb
code.vb
code.cs
.EXE / .DLL
39. .NET development
◆ There are currently 3 ways to develop assemblies:
1) .NET Framework SDK
• complete set of command-line tools and docs
• http://msdn.microsoft.com/net
• other platforms?
◆ FreeBSD / Mac OS X via Rotor (i.e. SSCLI)
◆ Linux via Mono project
40. Development options,
cont'd
2) Visual Studio (Various Editions)
• Visual Studio Express Edition (free)
• powerful, integrated development environment (IDE)
• one IDE for all: GUI, web-based, web service, DLLs, etc.
• this is what 99% of the world uses
3) Free IDEs
• #develop, a simplified clone of VS.NET
• WebMatrix, for building web-based applications
41. Hello World in C#
◆ Here's the source code:
/* hello.cs */
public class Startup
{
public static void Main()
{
System.Console.WriteLine("Hello World!");
}
}//class
hello.cs
42. Why System.Console
prefix?
◆ In .NET, all code & data must live within a module / class
◆ Often nested within namespaces to help organize things
■ a namespace is really just a named collection
◆ Example: System.Console.WriteLine("Hello World!");
System
namespace
in FCL
Console
class
WriteLine
subroutine
43. Compiling and running
◆ To compile C# with Framework SDK, use the C#
compiler
■ open Visual Studio .NET command prompt window to
set path
■ csc is the command-line C# compiler
■ use /t:exe option to specify console-based EXE as
target
c:> csc /t:exe hello.cs
Microsoft (R) Visual C# .NET Compiler version 7.00.9466
for Microsoft (R) .NET Framework version 1.0.3705
Copyright (C) Microsoft Corporation 2001. All rights reserved.
c:> hello.exe
Hello World!
44. Viewing an assembly with
ILDasm
◆ IL = Microsoft's Intermediate Language (i.e. generic asm)
◆ ILDasm = IL Disassembler
c:> ildasm hello.exe
45. IL?
◆ Very similar to Java bytecodes:
■ generic assembly language
■ stack-based
■ strictly typed
■ no direct memory addressing
■ verifiable for safe execution
46. Development on FreeBSD
◆ Working on FreeBSD is exactly the same!
■ i.e. same command-line tools as Framework SDK
■ produces *binary-compatible* .DLL and .EXE files!
47. Class-based development:
Example
◆ Here's the source code for a simple Customer class:
/* customer.cs */
public class Customer
{
public string Name; // fields
public int ID;
name, int id) // constructor
public Customer(string
{
this.Name = name;
this.ID = id;
}
// method
public override string ToString()
{
return "Customer: " + this.Name;
}
}//class
48. Main class
◆ Here's the source code for Main, using our
Customer class:
/* main.cs */
public class App
{
public static void Main()
{
Customer c;
c = new Customer("joe hummel", 94652);
System.Console.WriteLine( c.ToString() );
}
}//class
49. Compiling and running
application
◆ Compile and run as before…
■ /out: option specifies name of resulting EXE
■ in this case we are building monolithic app (single
EXE, no DLLs)
c:> csc /t:exe /out:app.exe main.cs customer.cs
Microsoft (R) Visual C# .NET Compiler version 7.00.9466
for Microsoft (R) .NET Framework version 1.0.3705
Copyright (C) Microsoft Corporation 2001. All rights reserved.
c:> app.exe
Customer: joe hummel
51. Compiling a component
◆ Use the C# compiler…
■ with /t:library option to specify component library as
target
■ csc produces a DLL in this case
c:> csc /t:library customer.cs
Microsoft (R) Visual C# .NET Compiler version 7.00.9466
for Microsoft (R) .NET Framework version 1.0.3705
Copyright (C) Microsoft Corporation 2001. All rights reserved.
c:> dir *.dll
customer.dll
52. Compiling and running
application
◆ Compile using C# compiler as before, except…
■ reference component so compiler can locate Customer class!
■ reference also stored inside assembly so CLR can locate
◆ To run, use name of assembly containing Main…
■ CLR follows reference to locate DLL
c:> csc /t:exe /out:app.exe main.cs /r:customer.dll
Microsoft (R) Visual C# .NET Compiler version 7.00.9466
for Microsoft (R) .NET Framework version 1.0.3705
Copyright (C) Microsoft Corporation 2001. All rights reserved.
c:> app.exe
Customer: joe hummel
54. mscorlib?
◆ mscorlib = "ms-core-lib"
◆ Core FCL assembly
■ contains core system classes like string
■ contains System.Console class for console-based I/O
◆ Automatically referenced for us by C# compiler…
55. All assemblies must be present
.EXE
other FCL
assemblies
CLR
JIT Compiler
obj code
OS Process
Underlying OS and HW
Core FCL
assembly
.DLL
.DLL
.DLL
obj code
obj code
obj code