You are on page 1of 42

T NG QUAN V ASP.

NET

N I DUNG
Gi i thi u v ASP.Net Web Server T o ng d ng Web u tin

Lm quen v i cc thnh ph n giao di n trn VS .Net Trao i, th o lu n


2

Gi i thi u v ASP.Net
Tm hi u v ASP.Net Nh ng u i m c a ASP.Net Qu trnh x l t p tin ASPX

Tm hi u v .Net Framework

Tm hi u v ASP.Net (1)
Cu i th p nin 90, ASP (Active Server Page) c s d ng r t ph bi n ASP - u i m:
M hnh l p trnh th t c n gi n S d ng hi u qu cc i t ng COM: ADO (ActiveX Data Object) - x l d li u FSO (File System Object) - lm vi c v i h th ng t p tin H tr nhi u ngn ng : VBScript, JavaScript

ASP - Nh c i m:
Code ASP v HTML l n l n Khi tri n khai ci t, do khng c bin d ch tr c nn d b m t source code, h n ch v t c th c hi n Qu trnh x l Postback kh khn
4

Tm hi u v ASP.Net (2)
u 2002, Microsoft gi i thi u k thu t l p trnh Web ASP+, tn chnh th c sau ny l ASP.Net ASP.Net l k thu t l p trnh v pht tri n ng d ng web pha Server d a trn n n t ng c a .Net Framework M l nh pha server (v d : m l nh trong trang ASP, ASP.NET) s c bin d ch v thi hnh t i Web Server. Sau khi c Server c, bin d ch v thi hnh, k t qu t ng c chuy n sang HTML/ JavaScript/ CSS v tr v cho Client
5

Nh ng u i m c a ASP.Net (1)
- Cho php l a ch n m t trong cc ngn ng l p trnh: Visual Basic.Net, J#, C#, - Trang ASP.Net c bin d ch tr c thnh nh ng t p tin DLL m Server c th thi hnh nhanh chng v hi u qu

Nh ng u i m c a ASP.Net (2)
H tr m nh m b th vi n phong ph v a d ng c a .Net Framework, lm vi c v i XML, Web Service, truy c p c s d li u qua ADO.Net ASPX v ASP c th cng ho t ng trong m t ng d ng S d ng phong cch l p trnh m i: Code behide Tch code ring, giao di n ring D c, d qu n l v b o tr Ki n trc l p trnh gi ng ng d ng trn Windows H tr qu n l tr ng thi c a cc control

Nh ng u i m c a ASP.Net (3)
T ng pht sinh m HTML cho cc Server t control tng ng v i t ng lo i Browser Tri n khai ci

Khng c n lock, khng c n ng k DLL Cho php nhi u hnh th c c u hnh ng d ng

H tr qu n l ng d ng

m c ton c c

Global.aspx c nhi u s ki n hn Qu n l session trn nhi u Server, khng c n Cookies

Qu trnh x

l t p tin ASPX

Tm hi u v .Net Framework (1)

10

Tm hi u v .Net Framework (2)


Ki n trc .Net Framework

11

Tm hi u v .Net Framework (3)


Phn nhm cc l p i t ng theo lo i

12

Web Server
Internet Information Services (IIS) Ci t Web Server

C u hnh Internet Information Services

13

IIS Khi ni m
IIS c th c s d ng nh 1 Web server, xy d ng cc k t h p v i ASP, ASP.NET

ng d ng Web t n d ng cc i m m nh c a Server-side Script, COM component theo m hnh Client/Server

14

IIS Ci

t (1)

B1: Control Panel | Add/Remove programs. B2: Add/Remove Windows Components. B3: nh d u vo m c Internet Information Services (IIS)

15

IIS Ci
B4: Ch n nt Next Sau khi ci wwwroot. C th truy c p c t o ra trong ci

t (2)
t. ng

t IIS, th m c InetPub t

C: v ch a th m c con n Website b ng cch:

http://localhost ho c http://127.0.0.1

16

IIS Ci
ki m tra ci truy c p t: Kh i

t (3)
ng trnh duy t

a ch : http://localhost

17

IIS C u hnh (1)


C u hnh IIS quy nh trang ch m c nh:
Start Settings Control Panel M m c Internet Administratrive tools Infomtic Services

18

IIS C u hnh (2)


Click ph i m c Default Website Ch n trang Documents m c nh quy Properties nh trang ch

19

IIS C u hnh (3)


C u hnh quy nh th m c o:
Click ph i: Default Website Directory Next New Virtual

Khai bo nhn cho th m c o (Myweb)

Khai bo th m c v t l (D:\MyWebsite) 20

IIS C u hnh (4)


Xc l p quy n truy c p

Finish
21

IIS C u hnh (5)


Ch y th ng d ng ki m tra

Ho c t trnh duy t nh p: http://Localhost/Maytinh

22

T o
Kh i

ng d ng Web u tin
ng MS Visual Studio .Net

T o m i ng d ng Web B sung cc i u khi n Thi hnh ng d ng Phn lo i t p tin trong ASP.Net

23

Kh i
Start 2005

ng MS Visual Studio .Net


Programs Microsoft Visual Studio Microsoft Visual Studio 2005

24

T o m i ng d ng Web (1)
Ch n t th c n File New Website

25

T o m i ng d ng Web (2)
K t qu : C a s Solution Explorer

26

T o m i ng d ng Web (3)
Trang Default.aspx (Design)

27

T o m i ng d ng Web (4)
Trang Default.aspx (Source)

28

T o m i ng d ng Web (5)
Trang Default.aspx.cs

29

B sung cc i u khi n (1)

Ko th control t Toolbox

30

B sung cc i u khi n (2)


Chuy n sang trang code Defaulr.aspx.cs Nh p code cho s ki n Page Load:

31

Thi hnh ng d ng (1)


Ki m l i tr c khi ch y: T Menu Build Ch n Build Web Site

32

Thi hnh ng d ng (2)


Ch y chng trnh B m Ctrl + F5 : chng trnh (khng debug) v F5 debug ch y ch y

33

Phn lo i t p tin trong ASP.Net (1)


ASP.Net ASP .asax Di n gi i d ng, session v cc s ki n khi c cc yu c u t i trang web .ascx .asmx .aspx Cc i u khi n do ng i dng t t o T p tin Web Service c a ng d ng ASP.Net .asp Ph n m r ng c a trang ASP.Net
34

.asa T p tin qu n l cc s ki n c a ng

Phn lo i t p tin trong ASP.Net (2)


ASP.Net ASP .config d ng XML. .cs .js .vb .js T p tin m ngu n vi t theo ngn ng C# T p tin m ngu n c a Jscript T p tin m ngu n vi t theo ngn ng VB.Net
35

Di n gi i T p tin c u hnh ng d ng theo nh

Lm quen v i giao di n
Solution Explorer Property Window Toolbox Document Outline Window

36

Solution Explorer (1)


Hi n th c a s Solution Explorer: View Solution Explorer Thao tc v i c a s Solution Explorer:
Th c hi n cc ch c nng: sao chp, c t, dn trn t p tin, th m c nh Windows Explorer T ch c th m c qu n l ng d ng: S d ng ch c nng Add New Folder t th c n ng c nh Add New Item Thm thnh ph n m i cho ng d ng: S d ng ch c nng Add

37

Solution Explorer (2)

38

Property Window
View Properties Window

39

Toolbox
View Toolbox

40

Document Outline Window


View / Other Windows / Document Outline

41

Trao

i, th o lu n

42