Sie sind auf Seite 1von 8

Microsoft ASP.NET 4.

0
======================
+ BOOK: MCTS -> asp.net 3.5, asp.net 4.0
+ ASP.NET :- Technology for Developing Web Applns
using .NET
+ Working of Web Application:
- Web appln : set of web pages (static / dynamic)
- static web pages - html pages sent
directly to client when request is made
- dynamic web pages - pages containing some
server side code which will be executed on
server side when request is made, then html
will be generated and that will sent to the
client.
- Web Server
- program provide service of running one/more
web applns in it
- IIS, Apache Web Server, Apache Tomacat,
JBOSS, Web Sphere, etc.
- Web Client
- program that consumes services provided by
web applns on the web server
- Web Browser, etc.
- Request / Response Model :
- web server is internally using socket to
listen on certain port.
- browser will create client socket and
connect to the server socket
- through socket client will send http
ASPNET_01.txt 7/2/2012 2:26 PM
Page 1 of 8
request to the server
- server will accept request and send to
appropriate appln.
- if request is for static page, page will be
loaded from the disk and its contents (html)
will be sent to the client in form of
response (throgh the same socket connection)
- if request is for dynamic page, page will
be loaded and processed (executed) on server
side, the html will genarated (rendering) and
sent to the client (throgh the same socket
connection)
- finally browser receive html response and
display html controls accordingly (rendering)
and socket connection is closed.
- Http Request:
- server ip, port, wep appln name, resource
name
- query string
- request method :
- GET
- data is sent via query string (in
url)
- faster
- less secure
- data limited due to size of url
- generated when form method=GET,
user click on hyperlink, redirection,
user enters url in browser
- POST
ASPNET_01.txt 7/2/2012 2:26 PM
Page 2 of 8
- data is sent in req body
- slower
- more secure
- data not limited
- generated when form method=POST,
upload
- HEAD
- to access only response headers
(information) without
accessing/downloading resp page
- PUT
- to upload file on web server using
http protocol
- DELETE
- to delete file on web server using
http protocol
- TRACE
- to trace/debug info on the web
server
- OPTIONS
- to know which methods are suppoted
on the web server
- cookies
- req body, req length
- req headers - browser and client machine
info
- Http Respose:
- resp code / status code :
- 403, 404, 302, 500, 200
- content type / mime type :
ASPNET_01.txt 7/2/2012 2:26 PM
Page 3 of 8
- text/plain, text/html, text/xml,
image/png, image/jpg, image/gif,
audio/mp3, video/mpeg, etc.
- resp length, resp body
- cookies
- resp headers - server info
+ ASP.NET Web Appln Life Cycle:
- user makes first request to the appln's some
web page (.aspx).
- IIS cannot handle req for aspx pages and hence
send it to the asp.net runtime (worker process
aspnet_wp.exe)
- for the req, in aspnet worker process, app
domain is created for the web appln, which is
represented by ApplicationManager object.
Seperate app domain for each object provide
security as well as functionality of
loading/unloading each appln individually.
- also for the first req object of
HostingEnvironment is created, which is used for
accessingf folders/resources/pages in the web
appln.
- for each request the core objects of
HttpRequest, HttpResponse and HttpContext will be
created.
- for the first req, HttpApplication obejct will
be created. This is responsible for activating
certain functionalities (caching) and managing
appln level events (handling through
ASPNET_01.txt 7/2/2012 2:26 PM
Page 4 of 8
Global.asax). For further reqs same appln objects
will be reused.
- finally req is processed at server side, resp
will be geneated and will be delived to the
client (HttpApplication pipeline) and then all
objects created per req will be destroyed.
+ ASP.NET Web Appln Life Cycle Events:
1. Application_Start
2. Application_End
3. Application_Error
4. Session_Start
5. Session_End
6. Application_LogRequest
7. Application_PostLogRequest
+ ASP.NET Web Pages:
+ Programming Models:
- Inline Model
- .aspx = markup (tags: html/asp) + event
handling code(C#)
- <%@ Page Language="C#" %>
- Compilation
- CodeBehind Model
- .aspx = markup (tags: html/asp)
- .aspx.cs = event handling code(C#)
- <%@ Page Language="C#"
CodeFile="___.aspx.cs"
Inherits="PageClassName" %>
- Compilation
ASPNET_01.txt 7/2/2012 2:26 PM
Page 5 of 8
+ Controls:
- Client Side controls
- HTML controls
- no processing at server side
- do not maintain state after post back
(submit)
- can be accessed directly only in client
side code (java script)
- fastest controls
- Server Side controls
- Server Side HTML controls
- Server Side ASP.NET controls
- processing at server side and generated
html sent to client
- maintain state after post back (submit)
- can be accessed easily in server side
code and also handle events on server
side.
- slower than client side controls
- Two Types
- Server Side HTML controls
- html control with
runat="server"
- used for migration from html to
asp.net
- not all asp.net features
supported e.g. themes
- all classes inherited from
ASPNET_01.txt 7/2/2012 2:26 PM
Page 6 of 8
System.Web.UI.HtmlControls.HtmlCo
ntrol
- lighter than asp.net controls
- ASP.NET controls
- <asp:___ ID="___" runat="____"
.... />
- used for rich functionality
- all asp.net features are
supported
- all classes inherited from
System.Web.UI.Controls.WebControl
- heavier that server side html
controls
+ Page class "IsPostBack" prooperty :
- when page is accessed first time from the
browser, IsPostBack=false.
- when page is submitted, in asp.net by
default form data will be posted back to
itself ( because form action is same page)
and hence IsPostBack=true.
ASPNET_01.txt 7/2/2012 2:26 PM
Page 7 of 8
ASPNET_01.txt 7/2/2012 2:26 PM
Page 8 of 8

Das könnte Ihnen auch gefallen