+ All Categories
Home > Documents > DevNext - Web Programming Concepts Using Asp Net

DevNext - Web Programming Concepts Using Asp Net

Date post: 13-Dec-2014
Category:
Upload: adil-mughal
View: 4,842 times
Download: 2 times
Share this document with a friend
Description:
 
35
Web Programming Concepts using ASP.NET Adil Ahmed Mughal Namrah Arif 3rd April, 2010 NED University of Engineering and Technology
Transcript
Page 1: DevNext - Web Programming Concepts Using Asp Net

Web Programming Conceptsusing

ASP.NET

Adil Ahmed Mughal

Namrah Arif

3rd April, 2010

NED University of Engineering and Technology

Page 2: DevNext - Web Programming Concepts Using Asp Net

Speaker(s)

• Adil Ahmed Mughal

• Development Executive at Telenor Pakistan

• Microsoft Most Valuable Professional

• Microsoft Certified Professional

• INETA, User Group Leader

• I blog at http://www.adilmughal.com

• Author of few articles on CodeProject.com

11

Page 3: DevNext - Web Programming Concepts Using Asp Net

Speaker(s)

• Namrah Arif

• Software Engineer at Folio3

• Graduated from NEDUET (CIS Dept.) in 2009

• Served as head Volunteer of DevNext at

NEDUET in 2009

• Active volunteer of DevNext and

Emerging .NET Devs User groups

Page 4: DevNext - Web Programming Concepts Using Asp Net

Agenda

• Background

• Web Fundamentals– HTTP Request

– Static and Dynamics Sites

– HTTP Forms

– Role of Web Server

• ASP.NET– ASP.NET Page Life Cycle

– Client Side vs. Server Side

– Understanding Submit vs. PostBack

– State Management and View State

Page 5: DevNext - Web Programming Concepts Using Asp Net

Pre-requisite

• Some working knowledge of Object Oriented

Programming Language such as C#, VB.NET or

Managed C++

• Basic familiarity with Web and ASP.NET

• Development Tools:– .NET Framework 3.5+

– Visual Web Developer or Visual Studio 2008 +

Page 6: DevNext - Web Programming Concepts Using Asp Net

Web Fundamentals

• HTTP Requests– The communication mechanism by which Web browsers talk to

Web sites – As a connection protocol, HTTP is built around several basic

commands– GET, HEAD, POST– HTTP is Stateless Protocol

Page 7: DevNext - Web Programming Concepts Using Asp Net

Web Browser(Client)

Web Site(Server)

HTTP GET Request

HTML to be rendered by browser

Page 8: DevNext - Web Programming Concepts Using Asp Net

Sample GET Command

GET http://www.adilmughal.com HTTP/1.1

Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, ... , */*

Accept-Language: en-us

Accept-Encoding: gzip, deflate

User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; ... .NET CLR 3.0.04506.30)

Host: localhost:80

Connection: Keep-Alive

Page 9: DevNext - Web Programming Concepts Using Asp Net

Sample Response

HTTP/1.1 200 OK

Server: Microsoft-IIS/5.1

X-Powered-By: ASP.NET

Date: Thu, 01 Nov 2007 23:44:04 GMT

Content-Type: text/html

Accept-Ranges: bytes

Last-Modified: Mon, 22 Oct 2007 21:54:20 GMT

ETag: "04e9ace185fc51:bb6"

Content-Length: 130

<html>

<body>

<h1> Hello World </h1>

Nothing really showing here yet, except some HTML...

</body>

</html>

Page 10: DevNext - Web Programming Concepts Using Asp Net

DEMOWeb Request using .NET (With out using Browser)

Page 11: DevNext - Web Programming Concepts Using Asp Net

Web Fundamentals

• Static Pages– The earliest web sites were built primarily using static HTML

pages.– HTML eventually evolved to be capable of much more

• HTML Forms– Notify browser that a section of HTML includes tags representing

controls– The contents of the form will be “posted back” to the server for

processing.

Page 12: DevNext - Web Programming Concepts Using Asp Net

Web Fundamentals

• HTTP Requests– GET vs. POST

Page 13: DevNext - Web Programming Concepts Using Asp Net

DEMOHTML Forms – GET Vs. POST

Page 14: DevNext - Web Programming Concepts Using Asp Net

Web Browser(Client) Web Site

(Server)

GET http://www.abc.com

HTML to be rendered by browser

POST http://www.abc.com

HTML to be rendered by browser

Page 15: DevNext - Web Programming Concepts Using Asp Net

Web Fundamentals

• Role of Web Server– A program on server that monitors port 80 for incoming HTTP

Requests

– On the Microsoft platform, IIS is the watchdog intercepting HTTP requests from port 80—the normal inbound port for HTTP requests

Page 16: DevNext - Web Programming Concepts Using Asp Net

Web Browser(Client)

Web Site(Server)

HTTP GET Request

HTML to be rendered by browser

IIS(Web

Server)

Page 17: DevNext - Web Programming Concepts Using Asp Net

Web Fundamentals

• Static and Dynamic Web Pages

“Dynamic means capable of action and/or change, while

Static means fixed”

• Static Web Pages:– The server where the page is stored returns the HTML

document to the user's computer and the browser displays it– The user may interact with the document through clicking

available links, or a small program (an applet) may be activated, but the document has no capacity to return information that is not pre-formatted

Page 18: DevNext - Web Programming Concepts Using Asp Net

Web Fundamentals

• Dynamic Web Pages:– The user can make requests (often through a form) for data

contained in a database on the server that will be assembled on the fly

– The request is relayed to the server using an intermediary, such as an Active Server Page (ASP) script embedded in the page's HTML. The intermediary tells the server what information to return

Page 19: DevNext - Web Programming Concepts Using Asp Net

Web Fundamentals

●What's the difference?– Static pages are those that send exactly the same response to

every request– Dynamic pages can customize the response on the server to

offer personalization based on cookies and information it can get from the visitor.

IMPORTANT!!! Flash and Shockwave presentations are also classed as static content; despite the fact that user interaction can lead to different ways of presenting the same data, everyone will download the same file from the server

Page 20: DevNext - Web Programming Concepts Using Asp Net

ASP.NET

• Web application development framework by Microsoft to easily create dynamic websites

• Built on top of CLR allowing programmer to write ASP.NET code using any .NET Languages (such as C#, VB.NET etc.)

• Main advantage is Rapid Application Development

• Works on Code behind model

Page 21: DevNext - Web Programming Concepts Using Asp Net

.NET Framework Overview

Operating System/Hardware

Internet Information Services

.NET Runtime (CLR)

ASP.NET

Data, LINQ, & XML

System

Communications & Workflow

Windows Presentation Foundation

Managed Application

.NET Class Libraries

Page 22: DevNext - Web Programming Concepts Using Asp Net

DEMOSimple ASP.NET Web Application

Page 23: DevNext - Web Programming Concepts Using Asp Net

Introduction to ASP.NET Pages

HTTP Handler

IISClient

Browser

Page 24: DevNext - Web Programming Concepts Using Asp Net

DEMOASP.NET Page Life Cycle

Page 25: DevNext - Web Programming Concepts Using Asp Net

ASP.NET

• Client Side vs Server Side– Client side is what's happening on your computer in your

browser. It has nothing to do with the server, or ASP or ASPX pages, or IIS, or the database.

– JavaScript in a web page would be an example of something client side. You don't need the server to help with the functionality of the script.

– when a web page is sitting in your browser after it has been processed by the server and sent "over the wire", there is absolutely no further connection with the server at this point.

– Client side scripting is usually done in VBScript or JavaScript. Since the code is included in the HTML page, it also poses as a possible security hazard for the client computer.

Page 26: DevNext - Web Programming Concepts Using Asp Net

ASP.NET

– Server side is when the server is being used to process something. Script or code that is run on the server does not appear on or in the web page that is sent to your browser -- the web page that your browser receives is only the result of the script or database code or processing that happened on the server.

– Server side scripting means that all the script will be executed by the server and interpreted as needed. Client side scripting means that the script will be executed immediately in the browser such as form field validation, clock, email validation, etc.

Page 27: DevNext - Web Programming Concepts Using Asp Net

DEMOSubmit Vs. PostBack

Page 28: DevNext - Web Programming Concepts Using Asp Net

State Management

• The problem of state– HTTP is a stateless protocol

– Traditional desktop applications have a portion of memory allocated

– Web applications are all together different

– ASP.NET facilitates programmers by creating an illusion of maintaining state using ViewState and other techniques

Page 29: DevNext - Web Programming Concepts Using Asp Net

DEMOViewState

Page 30: DevNext - Web Programming Concepts Using Asp Net

Web Forms vs. MVC Framework

• Common Web Presentation Patterns– MVC

• Ruby on Rails

• ASP.NET MVC

• MonoRail

• Others…– Web forms– Other patterns

• MVP

• MVVM

Page 31: DevNext - Web Programming Concepts Using Asp Net

Web Forms

• Tooling/designer• Postbacks• Event driven• HTML forms and viewstate• Controls abstraction• 3rd party component model• Rapid development• Declarative syntax• SharePoint use Web Forms

Page 32: DevNext - Web Programming Concepts Using Asp Net

ASP.NET MVC

• Full control over markup• Lightweight views/no Codebehind• Separation of concerns • Testing/TDD• Pluggable view engines• RESTful• No postbacks • No viewstate

Page 33: DevNext - Web Programming Concepts Using Asp Net

Making a choice

• Personal choice• Internet versus intranet• Control over markup• Familiarity with patterns• Gradual progression• RAD controls• SharePoint• They can be used together!

Page 34: DevNext - Web Programming Concepts Using Asp Net

THANK YOU!

Adil Ahmed Mughal

Namrah Arif

3rd April, 2010

Q & A

Page 35: DevNext - Web Programming Concepts Using Asp Net

Useful Links

• DevNext User Group Blog• http://www.DevNextUg.org

• Adil’s Weblog• http://www.adilmughal.com

• DevNext Facebook Page• http://www.facebook.com/DevNext


Recommended