Professional Documents
Culture Documents
:
:
.
!
:!"
$
# $ %
&
.%
' ( # *
) + ,
- !.
56 6 # *7
.# & .# /0 12 3
4 (4 * !+
.&
: # $%&
:(,8 *# 0. ! 9
9
-
9;& -
<
=
7+> 5 5 # -
! 5?, 5 -
1@ &
5,
A=4 IIS 84 #+ -
' " %
( 2) 5$# (8 B
2 5 .
5, * C .
<8 * .5$# /0. *@ , HTML 5$# *
4
.HTTP ! *+
(,8
:$
#
& ! 5$# 5 5 B$4
F
5$# (,8 !
*?=
8 C *8# ,HTML.+
*+= ! ,8# 5
& 1@ G <%8
F
.5,
H
I2 2 5 8@ 1 *
(1) '
* () & " ()
م
ص# ا$% ا
ا ب
& '
ا ()ا ﺏن ا 1
!( ا ﺏن
!
م
ا
ا ب
ص# ا$%
()ا ﺏن ا 2
& '
ا
!( ا م !
$%
م
ا
ا ب
ت$+ﺹ
Html - ()ا ﺏن ا 3
./0 وی$+ ا
ص
(2) '
* () & " ()
: 5&$ B$4 2 2 *8#
8
M
(,8 $# I$ L1 $
.M
(,8 $# I$ L2 $
: -.
(,8
(,8 $# I$ 2 +
.< 7 (> $ *8# .8 I
: 5&$ B$4 2 2 *8#
8
0#
I
:" () )
! 0 1 / 2
,F $# *
4 *@ *@ , ! *
2 ! $# ! %$
.
/0. (,8
*
:(2 HTML
0 1) )
! & 0 1 /3
.
I0 (4 $#
: -.
(,8
(,8 $# I$ 2 +
.< 7 (> $ *8# .8 I
(1) '" () )
! %&
! * ,8 !? *J 0. (,8
N
. *
) + ,
- .2
*;
:
* () )
!
:
-
DHTML 1@ (,8 +
$ 8 ! 8F •
$ (,8 !
0#
,8 K$ (,8
*O$ A
*$ •
+G ,8 *7) 1 *& %84 (4
$ 1 *8# J •
( P0 ! ,QR 5 A2
(2) '" () )
! %&
:" () )
!
:
) 3
*7 C
5
(4 * L
* +L 1 L
.5 8@ %
4 5
? 5+ <2
.
# '# I2 1 @ HTML 5$# L
.
/0. + !
*?=
# 8 V HTML . , * >
1 & L
.<2
7+2
B$ *
:
4
8 *& , > W
! *8# ,8
F L
.*8# *+
" () )
! 52 "4
:
! SQR 5
=2
PERL •
ASP •
ASP.NET •
PHP •
ColdFusion •
JSP •
5?, 2 ,
5? (,8 <8
B
<
6 ( A=4 (,8
+ K$ Shell script Perl C *7 ,
@ . *, ,
! 5 *$ (Common gateway interface) CGI
I
+ K$ V
/0. 0# ,8 8 *J . C,8 * I0 *?= X +
. (4 0# VW C
:
! SQR 5
=2
6 Z+ !. (Open source) $#
5 + .
B
:PHP •
*@ 1 $
+[ \#- % 1 +4 K$ ASP
6$; 6 /06. !
5#, 0G .
$# + <
X 5
.PHP
:Apache •
:Zeus •
:Apache "
5 (,8 <
/
1
Apache software foundation C@
\# X Apache
.Windows Novell Unix Linux *8
C68 php perl *67 6
56? 6 , C8 :
+0 % W
7+ 0. 1
\# $ (,8 /
(4 - G 5$# *+= +$ 5+- /
TLS SSL] 5&+
,
<
=6 < 6= 5
7+2 0. .U
2 *2 %
C
?7
C$ /
'
.2005 8 5A$4 $ ;- (,8
Windows 2003 Windows 2000 *?= X + <$ 0. 1 .Windows *?= X (,8
Windows XP pro server
B6@> 6 IIS 6
R .FTP, SMTP, NNTP, HTTP/HTTPS 5 IIS 6.0 $
6 <6 96 ! $ C ($ C+
=& = K$ Apache
56$ *+6= (6,8 6 B
IIS 7.0
! 5
?7
B
@ .> !$
.5+ /0. 1 * !
+2
9 *# 5+
IIS "
8
:
8 :
4 5 "
:
8 "
16 0. 57 B$[+ IIS Windows *?= X 5
4 %8
: *$
: -.
*6, 2
X +$ $ 5
Administrative tools 2 (,8
X$;
.IIS (4
I
6
I0 ,
INETPUB ,
4 ,8 <W, I
C2 <2 X$; +
.C,8 IIS 57
6 %6
2 %8 (,8 2
# (,8 , IIS 5
X[
> o
. W
5,
5 /0. , 5 (4 - +=
.5,
/0. %$ 5#, 8
#
# C
X I0 > o
+ + . + C,8 (4 4 FTP + SMTP + * % 5 IIS
6>
8 Pause L Stop L Start 5
5 I2 *# 94 *#
.5 /0. 2 (,8
: -.
.5> = W@ Property (,8 IIS W, 58- +
(64 6 , 584 $R W, $# 4 $#
= !#+
4 * ! '# + K$ 584 # $R !W, ,
. C 8 <W,
06. (4 *,
C I0 & . (
2) * !
,
*+ 3,
.,
0 !$ !W#
@2 %< 8 + ,
.,
, !$ !W#
,# 8
$ + (,82 2
L1
L
(,8
H + (4 + L <W 5#, * ,8 *
%
4 ,8 L2
.5$# ,
? I2 & , ,8
.!W#
@2 C+ !
&
+0 L3
M,
0. (4 *, SQR & $ ,R o
Universal Knowledge Solutions s.a.l 11
M
(,8 ,
0 !W# 1@ $ ,R o
.,
0. 5$ * 5$; $ ,R o
:*7
http://10.12.17.5/myweb/test.html
http://mydomain.com/test.html
:
XHTML ! P0
:
.*.G %84
*$ ! *$ *
4 K$ @
8 %
=G # P0
:!"
XHTML ! P0
!? .
(,8 , 5 > *8#
P0 ^ F
.#, .
8 P0 ,
/0.
: # $%&
:(,8 *# 0. ! 9
XHTML 8 $ •
XHTML ! P0 •
' XHTML 5%
XHTML 52 >?
:>? @
A
!6 P0 ' .,8#
7+2 HTML 5$# *
(4 9 H G P0 9_
F •
(4 5 /0. *
4 HTML $# ! %$ *$ 5 1 $#
I
K$
68 *6+ A
= 1 X P0 (4 K
) $ *$ P0 ,8# P
•
< 5, *4 +̀ 2 2 !
+4 ; X (4 2 +=
:>?
2
2 2 *4 *$ *$ /0. + 2 + .
7+2 2 *4 *$ P0 + •
W
($ 2 W@ 2
5
<form> </form> :
=G %<
$ P0
8 + •
*6 (, .P0
8 (,8 %
& B
2 HTML 5+ P0 I$ •
6+ + .(P0 *$ A* #+ \
= ! 8) <
< I$ 2 P0, + *7
! 8 .
T 2 JavaScript ?, +
(,8 I$ 2 P0,
5 ,8
6
68 (64 2 6
(4 *$ 5 '# *
R
, P0 *
4 8
:I, P0 8 ! *+=
R .
!
(4 2 !
+4
:$ # /0. a F .HTTP , *
4
5 *
4 ,2 # /0. $
2 (4 5 *
- '# C
I
K$ :POST
"4 >? L
. (4 *
S
R HTTP ,
T2 !
+4
8 (4
2 (4 5 *
- '# C
I
K$ :GET
"4 >? L
*
S
R HTTP , URL $R (4 9 9
$ ,, *+= (,8 !
+4
8 (4
. (4
*7 HTTP , *
- B
>
3. POST GET !
(4 -
POST GET
1 <
$ * + Connect Trace Delete PUT
.
. >
# <$&
2 + 04 ,
S
R 5 C4 * 2
I0
, Action # $ •
!
(,8 I$ $# URL $ 2 !
+4
8 #, %QR +
.
*
-
8 Action # ! $ (4 * *
- ,8 •
Universal Knowledge Solutions s.a.l 15
.Submit
:1 8
<FORM METHOD=”POST” ACTION=”SK@scs-net.org”>
… Content
</FORM>
$
8 (4
+
4 5 $ Submit
? 8 P0 0.
.SK@scs-net.org *7 !
:2 8
<FORM METHOD=”POST” ACTION=”getInfo.aspx”>
… Content
</FORM>
(,8 getInfo.aspx 9, (4
4 5 $ Submit
? 8 P0 0.
.,
S
R 5
!
I$ I0
:3 8
<FORM METHOD=”GET” ACTION=”Test.php”>
… Content
</FORM>
$ (4 5 [ 30 Test.php 9, (4 *
[ Submit
? 8 P0 0.
sami !. *$ @ 5+ name !. 4
*$ B$4 5+ 0[ $# URL
:! *+= *
- 8 URL $
X
http://myDomain.com/Test.php? name=sami
@ # /0. 0G .P0 5 *
4 8 SQR
EncType # $ •
5
/
B
5
,2 96a
. MIME
2
.
> 9
$ ! *+= #,
# !. P0 ! \ 9
$ W@ AcceptCharSet # $ •
! UNKNOWN # /0 W, + .5?, % P0 ! <
.P0
! 9
$ W@ # (4
=
@ *+= (,8 # @ 1 + 9
$ W@
7+2 &
$ 8 •
:! *7 ! *$ . + ,# , I
<Form AcceptCharset=”windows-1256,iso-8859-1”>
9
- 8 # /0. @
F .
> % 5$# W ! Target # F
(, .(P
I2
!
82 *$ !) P0 *
4
- C
X I0
!
4 1 K$ P0 5 *-
$ 8 # /0. F *7 *
.
H
4 K$
U
&
$ 8 HTML $#
5#
04 'W
= ! $
= @ ! 3, (,8 P0 K$2 5#
&
:!,
+0 B
2 K$2
:5# /0.
_ R CSS 5#, > * T
*$ ! # /0. SQF :Class L
.7 # Style %
=G
.7
8 ! I
2 9
%
=G /0. SQF :Style L
1
X- # /0. @ '# # K$
8 $ SQF :Title L
.
%
G#
=J
B /0. I$
:K$> /0.
>?
:8
5 *
4 ! POST
(,8 P0 9a
R HTML *7 0.
•
*
4 I
R
<
< I$ 9. 9,+ test.aspx 9, P0 $ •
, C4 5
C
X I0
- # (test.aspx 9, 0#
+) P0 0. (,8
&
X •
“_Self” P0 > P0
P0 0. (,8 “normalForm” I
“myForm” - P0 3, •
%
=G 7 # 2 CSS 7 < 9
0. + 2 &)
(STYLE
9, B$ *
R P0 2 ! “multipart/form-data”
P0 0. ! SR •
(4
P0 (,8
8 “you clicked the form”
X •
*4 *$ 9G .P0 ! < *$ U2
7+2 *4 *$
F •
$
*- b
*$
4 \ 9
$ 8 $ I
Size # *$ 0.
$ $ I
•
9
$ maxlength Size K$ maxlength #
5$ I
$ /0. ! .Size #
+2 maxlength # + 2 + •
+ A72 ! *$
*$, W, @ A8- Value # + •
(4 G
, 0 5; U +$, %
= H 2 HTML !
&
8 *$ ! G *W
X4 5
(4 2
., 5 2 1
:8
9
$ 10 * + test !. W, @ (,8 I$ mySample ! *$ A=-
:! + <
$ 40 c, 9
$ (@2
.,
Q R 9
$ !# U@ 1 *$+ *$ 0. SQR •
+ <T I0 U 9
$ 8 <8 B
* 9
$ J
== (4
X + & 04
“*” 2 "O" 9
$ $2
Universal Knowledge Solutions s.a.l 20
& 0. + == (4
X 2 *- ,8 A72 (“*” 2 "O") U 9
$
X4 I
•
A72 2 *- ,8 C,8 I
I0
(,8 , V
, R + 9
$ 2 !
. (4 5 *
4 ,8
:8
<input type=”password” name=”myPass” size=”10” maxlength=25 />
:8
<input type=”file” size=8 name=”myFile” accept=”text/*” />
9
$ 8 *$
8 + K$ myFile [ 9, *$ *$ A=4 I
*7 0. !
*7 8
# C2 1
Text 5#, *$ 0. * K$
.(text/html, text/css text/plain)
.<TEXTAREA> % =G 30 > *4 ! *$ 0. 8
:8
<TEXTAREA rows=”10” cols=”6” name=”myTextArea” wrap=”off”>
… This is a test
</TEXTAREA>
0. ! I
myTextArea 9
$ 10 U#
9
$ 6
$ *7 0. Z=R
. 9# * P0
:: #
: *&
$
+ K$
5@ 5
*+= *$ 0. *+= C= •
%$ 8
(4 ! ! *$
#, %R (,8 $ 5
1 *$ !. + P0 . ! •
Value
W84 “Checked” # 4
8 30 P0
X4 8 <W, $ *$ *# + •
$ 5
$ ! *$ . + “Checked”
:8
<input type="radio" name=”myRadio” vaue=”option1” checked=”checked”
/> first option<br>
<input type="radio" name=”myRadio” vaue=”option2” /> second option
<br>
<input type="radio" name=”myRadio” vaue=”option3” /> third option
R
; < “first option” *
4 I
K$
/;82 0# 8
X
:*+= !
: " C=
:8
<select name="select">
<optgroup label="Syria">
<option value="1">Damascus</option>
<option value="2">Aleppo</option>
<option value="3">Lattakia</option>
</optgroup>
<optgroup label="Jordan">
<option value="4">Amman</option>
<option value="5">Alakaba</option>
</optgroup>
</select>
! $ 9,
8
I
($ (4 P0 5 *
4 ! *
-
8 •
Method # ! %$
30 P0 Action #
P0
type # (4 “Submit” 4 2 (,8 input 0. •
#X # G button %
=G + •
:*7
<input type=”submit” name=”test” value=”Send”>
2
<button type=”submit” name=”test” value=”myValue”>text on
button</button>
: *9
] ($ /
2 8 #, %
T2 50
2 A=4 ! 0. 8 •
*#
*# $ K$>
> 0. ! I
•
!
> /0. , •
type # (4 Button 4 Button %
=G 2 Input %
=G
> /0. •
:8
<input type="button"
value="Please Don't Press This Button"
onclick="window.alert('any message.')" />
2
<button type="button"
value="anyValue"
onclick="window.alert(any message.')"> 'Please do not press
this button again.</button>
: "
0. 9 K$ , W
T + T
P0 !
# *$ •
P0 ' *$ ! .
X4 LP0 *
4 8L 5,
(4 *$
2 .Type # (4 “Hidden” 4 input %
=G *$ 0. •
Value # (4 %QR ! P0 *
4 8
4 I
!
:8
<input type=”hidden” name=”myHidden” value=”value we want to hide”
/>
: !. /;82 I$ P0 *
4 B
*$ ! (4 * ! $2 +
myHidden=value we want to hide
<body>
<form action="register.aspx" method="post" enctype="multipart/form-
data">
<table width="340" border="2" cellpadding="0" cellspacing="0"
bordercolor="#FFFFFF">
<tr>
<th width="185" bgcolor="#666666" scope="row"><span
class="style1">Login Name</span></th>
<td colspan="2"><input name="login" type="text" id="login"></td>
</tr>
Universal Knowledge Solutions s.a.l 28
<tr>
<th bgcolor="#666666" scope="row"><span
class="style1">Password</span></th>
<td colspan="2"><input name="pass" type="password" id="pass"></td>
</tr>
<tr>
<th bgcolor="#666666" scope="row"><span class="style1">Full Name
</span></th>
<td colspan="2"><input name="fullName" type="text"
id="fullName"></td>
</tr>
<tr>
<th bgcolor="#666666" scope="row"><span
class="style1">Sex</span></th>
<td width="64"><input name="sex" type="radio" value="male">
male</td>
<td width="81"><input name="sex" type="radio" value="radiobutton">
female</td>
</tr>
<tr>
<th colspan="3" bgcolor="#666666" scope="row"><span
class="style1">Address</span></th>
</tr>
<tr>
<th colspan="3" scope="row"><textarea name="address" cols="50"
id="textarea"></textarea></th>
</tr>
<tr>
<th bgcolor="#666666" scope="row"><span
class="style1">Email</span></th>
<td colspan="2"><input name="email" type="text" id="email"></td>
</tr>
<tr>
<th bgcolor="#666666" scope="row"><span class="style1">type of
membership</span></th>
<td colspan="2"><select name="select">
<option>MASTER MEMBERSHIP</option>
<option>NORMAL MEMBERSHIP</option>
<option>GUEST MEMEBERSHIP</option>
</select></td>
</tr>
<tr>
<th bgcolor="#666666" scope="row"><span class="style1">picture
File</span></th>
<td colspan="2"><input name="myPicture" type="file" id="myPicture"
size="10"></td>
</tr>
<tr>
<th colspan="3" bgcolor="#666666" scope="row"><span
class="style1">interested in </span> </th>
</tr>
:
GET POST
HTTP ,
:
.
/
4 *+
,
: # $%&
:(,8 *# 0. ! 9
HTTP 5, •
5, *
4
•
& (,7
= POST GET !
•
:"
58
($
LO 6 8) (Learning Objects) 5$ 4 •
B$4 4 +4 ^ “Method” # “Form” %
=G,
A72 ,
!
+0
2 5 *
4 I
9+ $ # /0. 2
+0 # /0 “GET” 2 “POST”
.HTTP , *
- F !
:HTTP
.5
> += (,8 5 *@ R !> ! *+
HTTP *+
R
) ('#) (
/ ,) H HTTP *+
(
:HTTP
Universal Knowledge Solutions s.a.l 31
.HTTP , *
[ HTTP ,@ 2
A
> /0. !,
.! *+= !
X + A
> 8
HTTP , +
.A
*+ ,$ ! 5, U <$& $
GET / HTTP/1.1
1
Connection: Keep-Alive
2
4 Content-type:application/x-
www-form-urlencoded
Content-length:23
5 Name=sami&type=3
2
3 ,
4 +
5 +
! I
!
(,8 I$ C2
HTTP , + A
> (4 %
: B$4
/0. 0G .5, *
4
HTTP *+
8 + XHTML P0 1 * A72
. F
:
+0 B
>
04 *7 * (, .!=
8 9, @
8 %
7+ <2 GET SF
+ click here , + , (,8
8 test.aspx 9, (4 X=10
2
!7 A
:
ASP.NET (4
:
.V 57
52
W *8
4
:!"
57 #+ (,8 *# 0. ! 9
.
*
! %W
5 ASP.NET
.Visual Studio.net
W (4 - /0 *
4
: # $%&
:(,8 *# 0. ! 9
ASP.NET 8 •
.Net *
4 57 •
" () )
! 0;
ASP.NET "4
:ASP.NET
C
8
.NET *
4 57 $ I0# 9, 57 $ + 04 .< * ASP.NET
W 57 R
..NET7 5#,
,72 57 +[ , 5
57 V .ASP.NET I0
/0. (,8 .8 & Windows Installer 5+ K$ 57 V , 2 +
:!, +
$ ==
X 2 + 04 57 ,
;
ASP.NET
C
8
.,7> 8
(4 4
52 57 +4 V
ASP.NET
C
8
W *.4 ASP.NET 5#, *?= + <& <
= Visual studio .NET 57
^ 2 T
A> 4 5H +$
8 5
*; 30
,8 A72 8
C 3,
.B
> 5
7+ (4 - ?, 5
# !+0 $ 5H *?= W 8
Visual Studio.net
8
f ! *$ !. + #, 5? 1 *, 52 57 V , .NET *8
4 <
X
U
! I
! ?,
Visual studio .NET *?= !#+ 04 3,
W
.NET *
4 5? ? I2 1 * W
a (,8 ,> 0. *a R ./J=4
.*, %
W 1 ,@G (4
$
: -.
.IIS 57 (4
+ P$ ASP.NET 2 <2 C &
ASP.NET ?
7
(1
2 %$ %
9
= .0# 2 2 /
(,8 .0# 2 *+ +) .Net Framework 57 ,8 0#
. 57 *$
(,8 <8
:09 /
8 ?2
(- •
:
4 M4 52 #
NO 5
8 " P <
Visual Studio .Net
8 •
.=; Q 1
) ; S 2 9 TA7O 8 A
" "4O #) 0 8 "4 # •
.6
7
U
O :
A
" Visual Studio .Net
:
HTML +$
8
:
%
=G
+$
8
:!"
3, .2
+$
8
. $# 5+
+2 +$ $ % 5 ASP.NET 5@
.5
HTML +$
8 .
/0. A
(,8 9
,
/0. *; *$
: # $%&
:(,8 *# 0. ! 9
+$
8 •
HTML +$
8 *$ *# •
5,
*; *$
# (,8 5,
! ,
h
.*
0. ! %W
5 B$4 .
8 (,8 ASP.NET ?
: C
;
5#, 1 L
*?= + ($L &
.
& 5,
$2 2 wwwroot ,
(,8
<html>
<head>
</head>
<body>
<p> this is only a test that contain html.</p>
</body>
</html>
$ C4 *
! C,?= 7 (.ASPX) $; 0. X#$ 2 +
.C !
$# B$
X[ 9, 0. .0# ASP.net 5, I2 *7 0. ! I$ &
.
(,8
5,
*; *$
# (,8 5,
! ,
h
.*
0. ! %W
5 $2 .
8 (,8ASP.NET ?
: C
;
5#, 1 L
*?= + ($L &
.
& 5,
$2 2 wwwroot ,
(,8
/8 B
K$ .ASP.NET !
$ <% %> %
=G •
:! *+= C (ASP.NET 9,) ASP 1
runat # (4 server 4 1 HTML <Script> %
=G •
:! *+= (,8 +
' K$
<script runat=server>
The code goes here
</script>
7ASP
:8
<html>
<body bgcolor="yellow">
<center>
<h2>Hello W3Schools!</h2>
<p><%Response.Write(now())%></p>
</center>
</body>
</html>
:
+$
8 2 U2 7;7 ASP.NET
HTML +$
8 .1
(ASP.NET %
U2 !. ) +$
8 .2
* $ ! 8 +$
8 .3
$
+$
8 .2 5,
*; ,
/0. A72 Gi$&
ASP.NET ! K$> #
%
&
0 A *@ + .,7G
.,72 ,T2 ! C >
!
I2 2 ! !. SB9
)
( (,8
5
7+
.K$ V !
0. ( K$ <
+ 2
/0# I
:8
:! !
(4
X
<%
lbl1.Text="The date and time is " & now()
%>
<html>
<body>
<form runat="server">
<h3><asp:label id="lbl1" runat="server" /></h3>
</form>
</body>
</html>
:*J \
2 04
j /;82 $ !
0. 0# (
!!!,& : <$
- +
!
I2 2 ! !. SB9
)
( (,8
5
7+
.K$ V !
0. ( K$ <
+ 2
/0# I
!
I2 2 ! !. SB9
)
( (,8
5
7+
.K$ V !
0. ( K$ <
+ 2
/0# I
/0.
ASP.NET 9,
X ! , html %
=G $ ! J
$
1 *$ 9, . $#+ V
X4 7
*@ .
# I
I8 + %
=G
. #
, ,@ 5++
3, *F K$
HTML +$
8
4 %
=G /0 runat # 4 !#+ +$
+ *S F HTML %
=G *
9
a R + *@ <$& I
K$ (ID) #, @ A84 4 "SERVER"
.!
*?= 8 +$
8 (4 *,
: % -.
8 %
(4 /& 1 <form> %
=G
+$
8 1
X 2
2 ;8- 30 ID #, @ runat #, . I2 +$
8 %
=G /0.
* + 0 %
$
l 2 9
P0+ C *
P0 0.
.
!
*@ 4
:8
ASPX 9, !=
U +$
8 8 '
@ *7 0. !
.!
!
X +
0 ID #, "link1" A84
%
=G $ ! J
$html 9,
X ! , ASP.NET /0.
1 *$ 9, . $#+ V
X4 7
*@ .
# I
I8 + %
=G
+$
8HTML. #
, ,@ 5++
3, *F K$
4 %
=G /0 runat # 4 !#+ +$
+ *S F HTML %
=G *
9
a R + *@ <$& I
K$ (ID) #, @ A84 4 "SERVER"
.!
*?= 8 +$
8 (4 *,
HTML" ()
:HTMLANCHOR 5
#7
.<a> %
=G . !=
A=- 0. +$
8 *
:
0. *7 I0 !
? 5; .2
ATTRIBUTE
@
0. 5# 1
W@ S
0 $ 9^ R ID
& 0. =J 3 $ 8 X 9 I0 TITLE
ONSERVERC
, /0. (,8
8 /0# I
I0 1 LICK
:8
<script runat="server">
Sub Page_Load
link1.HRef="http://www.google.com"
link1.Target="_blank"
link1.Title="google"
link2.HRef="http://www.microsoft.com"
link2.Target="_blank"
link2.Title="Microsoft"
End Sub
</script>
<html>
<body>
<form runat="server">
<a id="link1" runat="server">Visit google!</a>
<br />
</body>
</html>
. google 1@ !7 MSN 1@ .$2 , A=[ 7
+ 5, 1 K$ $# B$ ,+ 8 , !
,+
S 2 X$; +
.*7 ! Page_load K$ V
.
+$
W @ H $ %
0 $ 9^ R ID
:8
.
*+
8 9, ,
O XR #, ,
*7 0.
O XR
:Page_load $# *$ K$ +$
8 , ! K$> 2 X$;
Sub event_name (source as object , e as eventargs)
…..
End sub
.(7 $ !) onserverclick #, K$ @ A84 K$ V K$ !#+
<script runat="server">
Sub button1(Source As Object, e As EventArgs)
p1.InnerHtml="You clicked the blue button!"
End Sub
Sub button2(Source As Object, e As EventArgs)
p1.InnerHtml="You clicked the pink button!"
End Sub
</script>
<html>
<body>
<form runat="server">
<button id="b1" OnServerClick="button1"
style="background-color:#e6e6fa;
height=25;width:100" runat="server">
Blue button!
</button>
<button id="b2"
OnServerClick="button2"
style="background-color:#fff0f5;
height=25;width:100" runat="server">
Pink button!
</button>
<p id="p1" runat="server" />
</form>
</body>
</html>
ACTION
$ # A84
+$
8 $ !
.<W $ $#
. @ 5# 1
W@ ATTRIBUTES
0 $ 9^ R ID
:8
ID 6 @ $ @
+$
8 2 (,8 <P> %
=G 1 ! *7 ! *
:innerHtml @
? Submit
(,8
K$ V ,
7
0
<script runat="server">
Sub submit(sender As Object, e as EventArgs)
if name.value<>"" then
p1.InnerHtml="Welcome " & name.value & "!"
end if
End Sub
</script>
<html>
<body>
<form runat="server">
Enter your name: <input id="name" type="text" size="30" runat="server" />
<br /><br />
<input type="submit" value="Submit" OnServerClick="submit" runat="server" />
<p id="p1" runat="server" />
</form>
</body>
</html>
. - 8 BORDER
0 $ 9^ R ID
% 8 WIDTH
:8
<script runat="server">
Sub choose_image(Sender As Object, e As EventArgs)
image1.Src = select1.Value
End Sub
</script>
<html>
<body>
<form runat="server">
<select id="select1" runat="server">
<option value="smiley.gif">Smiley</option>
<option value="angry.gif">Angry</option>
<option value="stickman.gif">Stickman</option>
</select>
<input type="submit" runat="server" value="Display image"
OnServerClick="choose_image">
</body>
</html>
%$ $ image1 +$
8 .
X ! %
* I
*7 0. !
. <option> +$
@ VALUE
:8
<script runat="server">
Sub submit(sender As Object, e as EventArgs)
if name.value<>"" then
p1.InnerHtml="Welcome " & name.value & "!"
end if
End Sub
</script>
<html>
<body>
<form runat="server">
Enter your name: <input id="name" type="text" size="30" runat="server" />
<br /><br />
<input type="submit" value="Submit" OnServerClick="submit" runat="server" />
<p id="p1" runat="server" />
</form>
!.
&FALSE
0 $ 9^
R ID
@ VALUE
:*7
<script runat="server">
Sub submit(Source As Object, e As EventArgs)
if red.Checked=True then
p1.InnerHtml="You prefer red!"
else
p1.InnerHtml="You prefer blue!"
end if
red.checked=false
blue.checked=false
End Sub
</script>
<html>
<body>
<form runat="server">
What color do you prefer?
<br />
<input id="red" type="checkbox" runat="server" /> Red
<br />
<input id="blue" type="checkbox" runat="server" /> Blue
<br />
<input type="button" value="Submit" OnServerClick="submit" runat="server"/>
<p id="p1" runat="server" />
!.
&FALSE
0 $ 9^
R ID
4 NAME
# = VALUE
:*7
<script runat="server">
Sub submit(Source As Object, e As EventArgs)
hidden1.Value=string1.Value
p1.InnerHtml="Hidden value= " + hidden1.Value
End Sub
</script>
<html>
<body>
<form runat="server">
Enter some text: <input id="string1" type="text" size="25" runat="server" />
<input type="submit" value="Submit" OnServerClick="submit" runat="server" />
<input id="hidden1" type="hidden" runat="server" />
<p id="p1" runat="server" />
</form>
</body>
</html>
!.
&FALSE
0 $ 9^
R ID
, /0. (,8
8 /0# I0 1 ONSERVERCLI
CK
0GServer
+$
8 2 $ RUNAT
@ VALUE
:*7
<script runat="server">
Sub button1(Source As Object, e As ImageClickEventArgs)
p1.InnerHtml="You clicked the smiley button!"
End Sub
Sub button2(Source As Object, e As ImageClickEventArgs)
p1.InnerHtml="You clicked the angry button!"
End Sub
</script>
<html>
<body>
<form runat="server">
<p>Click on one of the images:</p>
<p>
<input type="image" src="smiley.gif"
OnServerClick="button1" runat="server" width="32" height="32" />
</p>
<p>
</body>
</html>
72 EventArgs 8 <8 imageClickEventArgs *7 0. ! X$;
.%
(,8
K$ V 9
!.
&FALSE
0 $ 9^
R ID
4 NAME
# = VALUE
:*7
<script runat="server">
Sub submit(Source As Object, e As EventArgs)
if r1.Checked=True then
p1.InnerHtml="Your favorite color is red"
else
if r2.Checked=True then
p1.InnerHtml="Your favorite color is green"
else
if r3.Checked=True then
p1.InnerHtml="Your favorite color is blue"
end if
end if
end if
End Sub
</script>
<html>
</body>
</html>
!.
&FALSE
0 $ 9^
R ID
!">ع ا5ﻥ TYPE
!">'
ا VALUE
& 2 !W
0. + $ @ VISIBLE
!.
& @FALSE
0 $ 9^
R ID
0. ;T4 ' ! =G $ %84 2 INNERHTML
5@
V ! 8
# W
- (4 /0.
ONSERVERCHA
NGE
W
,
? K$
0GServer
+$
8 2 $ RUNAT
/
I0
$ '$ 8 . * SELECTEDINDE
X
T
*$ ! 1 (4
& W@ U#
SIZE
:*7
<script runat="server">
Sub choose_image(Sender As Object, e As EventArgs)
image1.Src = select1.Value
End Sub
</script>
<form runat="server">
<select id="select1" runat="server">
<option value="smiley.gif">Smiley</option>
<option value="angry.gif">Angry</option>
<option value="stickman.gif">Stickman</option>
</select>
<input type="submit" runat="server" value="Display image"
OnServerClick="choose_image">
<br /><br />
<img id="image1" src="smiley.gif" runat="server" width="32" height="32" />
</form>
</body>
</html>
*
%0$ $ ALIGN
*
,
- + $ BORDER
*
,
- $ BORDERCOLOR
!.
& @FALSE
*
U#
$ HEIGHT
0 $ 9^ R ID
0. ;T4 ' ! =G $ %84 2 INNERHTML
*
0GServer
+$
8 2 $ RUNAT
*
8 WIDTH
:*7
<script runat="server">
Sub submit(sender As Object, e As EventArgs)
dim i,j
table1.BGColor="yellow"
table1.BorderColor="red"
for i=0 To table1.Rows.Count-1
for j=0 To table1.Rows(i).Cells.Count-1
table1.Rows(i).Cells(j).InnerHtml="Row " & i
next
next
End Sub
</script>
<html>
<body>
<form runat="server">
<table id="table1" border="1" runat="server">
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
</tr>
<tr>
<td>Cell 3</td>
<td>Cell 4</td>
</tr>
</table>
<br />
<input type="button" value="Change Contents" OnServerClick="submit" runat="server"/>
</form>
</body>
</html>
!.
& @FALSE
ABارع ا HEIGHT
0 $ 9^
R ID
0. ;T4 ' ! =G $ %84 2 INNERHTML
W CSS
0. (,8 ! STYLE
:*7
<script runat="server">
Sub submit(sender As Object, e As EventArgs)
Dim row,numrows,numcells,j,i
row=0
numrows=rows1.Value
numcells=cells1.Value
for j=1 to numrows
Dim r As New HtmlTableRow()
row=row+1
for i=1 to numcells
Dim c As New HtmlTableCell()
c.Controls.Add(New LiteralControl("row " & j & ", cell " & i))
r.Cells.Add(c)
next
t1.Rows.Add(r)
t1.Visible=true
next
End Sub
</script>
<html>
<body>
</body>
</html>
!.
& @FALSE
!O6ارع ا HEIGHT
0 $ 9^
R ID
0. ;T4 ' ! =G $ %84 2 INNERHTML
W CSS
0. (,8 ! STYLE
0 $ 9^ R ID
<script runat="server">
Sub submit(sender As Object, e As EventArgs)
p1.InnerHtml = "<b>You wrote:</b> " & textarea1.Value
End Sub
</script>
<html>
<body>
<form runat="server">
Enter some text:<br />
<textarea id="textarea1" cols="35" rows="6" runat="server" />
<input type="submit" value="Submit" OnServerClick="submit" runat="server" />
<p id="p1" runat="server" />
</form>
</body>
</html>
P"
:
P0 +$
8
:
K$2
W %
=G
+$
8
:!"
3, .2 !.
+$
8
. $# 5+
+2 +$ $ % 5 ASP.NET 5@
.5
. P0 +$
8 ,8 ,
+$
8 B
2 8
,
/0. !
C I0 *, C= * P0 +$
8 B
2 8
<
T @ o
:(4 30 ! .HTML +$
8
. 5
<W, ! 5 5> A ,8 * -
I0
> HTML +$
8 *8
@ *@G P0 A=4 ,8 * -
.A2
8 *@2
*
# ! W %$ A2 P0 +$
8 HTML +$
8 + o
> 8 listBox 8 HTML +$
SIZE *7 *7 * (, .&
+
H HTML +$
8 ! Cols /0. ' .W W
1
! %$ +$
8
8 8
! WIDTH + $ ! .TextArea
.
8 $ P$ ! P0 +$
8
2 $ 1
, W, 4 *7 %8 4 5 P0
8 3, o
.
+
=6 36, 6
+06 .K$> W
W P0 +$
8
:Webcontrols 9 7
W 9
K$>
.( @ ) 5W7 1
%84
Attributes & ! W)
T W %A
+
?, I
9 <A
*+=HTML (4 *, 2 (
.+S
=R
T
W
.
(,8 8 I0
& \# %84
AccessKey
.#, $
BackColor
.
- %84
BorderColor
.(....
)
4 %84
BorderStyle
.
- + %84
BorderWidth
*@
9
@ %84 ASP.NET
ClientID
( >) !$ +$
(A>) +$
8 %84.
Controls
.& 2 ;
< #
+ 04 %84
Enabled
@ (,8 X$
+ 04 $ @ %84
EnableViewS
?Viewstate .CW2 1
0
tate
U %84
Font
Universal Knowledge Solutions s.a.l 72
+$
8 2 B$ , %84
ForeColor
.
U#
%84
Height
0. +$
9
%84
ID
+$
8 (,8 I$ $# W+ (4
=J %84
Page
8 @; !
*, +$
8 2 (4
=J
Parent .$# W+ +$
> 1
8
*7 CSS+$
8 (,8
Style
? B
& *
+$
8 *, %84
TabIndex
Tab
.+$
8 %
G#
=J 3
$ B
X I0 %84
ToolTip
P
! +$
8
X4 2 A#4 $ @ %84
Visible .$#
.CW2 1
! +$
8 ! 5
*#
DataBind
.+$
8
8 %84
Width
+$
8 8 !$ W+ K$
FindControl
+$
8 +$
+ 04 $ @ %84
HasControls .A
K$ 5
+$
8
8 K$ 0.
X
DataBinding
6.2
!, . 7
! 3, (4 < 4 % W W
+$
8 3,
.+$
8 $ W W
3,
HyperLin
ImageUrl, NavigateUrl, Target, Text -
k
OnClick,
LinkButto CommandArgument, CommandName,
OnComm
n Text, CausesValidation
and
Image AlternateText, ImageAlign, ImageUrl -
Panel BackImageUrl, HorizontalAlign, Wrap -
Label Text
OnClick,
CommandArgument, CommandName,
Button OnComm
Text, CausesValidation
and
AutoPostBack, Columns, MaxLength,
OnTextC
TextBox ReadOnly, Rows, Text, TextMode,
hanged
Wrap
CheckBo OnCheck
AutoPostBack, Checked, Text, TextAlign
x Changed
OnCheck
RadioButt AutoPostBack, Checked, GroupName,
Changed
on Text, TextAlign
OnClick,
OnComm
ImageBut CommandArgument, CommandName,
and
ton CausesValidation
TableRo
Cells, HorizontalAlign, VerticalAlign -
w
ColumnSpan, HorizontalAlign, RowSpan,
TableCell -
Text, VerticalAlign, Wrap
Literal Text -
PlaceHol
- -
der
<html>
<body>
<form runat="server">
<asp:Button id="button1" Text="Click me!" runat="server" OnClick="submit"/>
</form>
</body>
</html>
:2 8
6
& 6 %
$ @ 2 X$; K$ !=
& +$
8 !7 7 *
!6 %06 6
- 9
I0 (URL) ! I
$ @ (4 -
.
& ' I
<html>
<body>
<form runat="server">
<asp:HyperLink ImageUrl="myImage.jpg" NavigateUrl="http://www.sk-www.com"
Text="Visit sk!" Target="_blank" runat="server" />
</form>
</body>
</html>
.
+$
8 1 *
P0 +$
8 1 *
' C= 3.
.
/0. ? H
,7> ' .HTML
6+ 9
$ *; (,8
W @ > <
X HTML +$
8
. HTML 5
=G ! *$ .
@
R @ 8 2
T2 8 %
8 /0. + 2 + 04 P0 +$
8 1 *$ 9,
P06 +$
(
(4 %
%0$ 8 + *7 * (, .(Enumerated)
:%
<ASP:Image Src="mypic.gif" ImageAlign="Right" runat="server" />
6
6
8
9
K$ imageAlign.Right
, @ A84 I
.C
I0
6, import 30 @
R
A2
(,8 TypeDescriptor
? 8
. Namespace 6 1
<%@Import Namespace="System.ComponentModel" %>
TypeDescriptor.GetConverter(GetType(HorizontalAlign)).ConvertFromSt
ring("Left")
6+ 9
$ *; (,8
W @ > <
X HTML +$
8
. HTML 5
=G ! *$ .
@
R @ 8 2
T2 8 %
8 /0. + 2 + 04 P0 +$
8 1 *$ 9,
Universal Knowledge Solutions s.a.l 76
.(Enumerated)
@
6 !6
Q6R $ .NET *8
4 WinCV %> <2 +
:*+= !
X +
. T (4 = ! G= 0 + @ R , 0.
BackColor, W6 6$2 (4 4 $ !. (> ,., @ $ 0G
6, @ A84
7+2 (4 , @
m+ 04 P$ & @ .ForeColor, BorderColor)
:%<
=
<asp:textbox id="MyText" Text="This is a textbox" runat="server"
BackColor="Red" ForeColor="White" />
FromArgb
6$> (4 < 4 #= :C+
*; A=[
.
>
>
FromKnownCol ! % 5, < , W+ A=[
or
HTML
FromName
# ,
=8 W+ A=[
! HTML
:8
W *$+ P0 +$
8 W (4 Unit 9
T2 4 I
Width Border Height Width
: %$ (,8 &, Px % @ *7 0. ! X$; +
<asp:image id="MyImage" Src="mypic.gif" runat="server"
Height="100px" Width="50%" />
*68 A672 6@ A8- 9 . ! W W
+
/0. (4 4
.V
C6> /
& !8 & 30 P0 +$
A> A A
Unit 9 +
:*7
MyControl.Height=Unit.Pixel(50)
W *$+ P0 +$
8 W (4 Unit 9
T2 4 I
.Width Border Height Width
6
68
B P0 *
4 ,8 *# 5&$ ! , !,8# P0 A 8
. 5
& 8 $# K$ , 'R K$
1
*# 2 W@
$#6 *
4 I
($ AutoPostBack (4 True 4 !#+ ASP.NET ! 2
.C /0. I0 +$
8 (,8 * *+ (4
:AutoPostBack "
6
8
& B P0, *
4 ,8 *# 5&$ ! , !,8# P0 A 8
. 5
& B $# K$ , '
1
*# 2 ;
< 7 W@
(64 $# *
4 True (4 AutoPostBack @ !#+ ASP.NET !
.True (4 C /0. @ I0 +$
8 (,8 * *+
/A6?4 V
6 6$ W, %
*_ #Q R P0 B$ (,8 A- + ASP.NET ! 2
:%
$#
@ %
<%@ Page EnableViewState="false" %>
: *7
<script runat="server">
Sub submit(sender As Object, e As EventArgs)
lbl1.Text="Hello " & txt1.Text & "!"
End Sub
</script>
<html>
<body>
<form runat="server">
Your name: <asp:TextBox id="txt1" runat="server"
EnableViewState="false" />
</body>
</html>
/A?4 V
$ W, %
*_ #Q R P0 B$ (,8 A- + ASP.NET ! 2
.$#
@ %
8
*# X$; K$ checkBoxList P0 +$
8 ! *7 !
[ W
8
8 I2 (,8 %
*+ 8 V
0. .AutopostBack
<html>
<body>
<form runat="server">
<asp:CheckBoxList id="check1" AutoPostBack="True"
TextAlign="Right" OnSelectedIndexChanged="Check"
runat="server">
<asp:ListItem>Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
<asp:ListItem>Item 3</asp:ListItem>
<asp:ListItem>Item 4</asp:ListItem>
<asp:ListItem>Item 5</asp:ListItem>
<asp:ListItem>Item 6</asp:ListItem>
</asp:CheckBoxList>
<br />
<asp:label id="mess" runat="server"/>
</form>
</body>
</html>
*+= (,8 + *7 0. 0#
8
. DropDownList P0 +$
8 ! *7 !
.
(,8 I$
X[ Submit
(,8
8 V
0.
<html>
<body>
<form runat="server">
<asp:DropDownList id="drop1" runat="server">
<asp:ListItem>Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
<asp:ListItem>Item 3</asp:ListItem>
<asp:ListItem>Item 4</asp:ListItem>
<asp:ListItem>Item 5</asp:ListItem>
<asp:ListItem>Item 6</asp:ListItem>
</asp:DropDownList>
<asp:Button Text="Submit" OnClick="submit" runat="server"/>
<p><asp:label id="mess" runat="server"/></p>
</form>
</body>
</html>
8
. DropDownList P0 +$
8 ! *7 !
.
(,8 I$
X[ Submit
(,8
8 V
0.
<script runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
if check1.Checked then
panel1.Visible=false
else
panel1.Visible=true
end if
End Sub
</script>
<form runat="server">
<asp:Panel id="panel1"
runat="server" BackColor="#ff0000"
Height="100px" Width="100px">
ASP.NET
</asp:Panel>
<asp:CheckBox id="check1"
Text="Hide Panel control"
runat="server"/>
<br /><br />
<asp:Button Text="Reload" runat="server" />
</form>
</body>
</html>
8
: tableCell,tableRow table P0 +$
8 ! *7 !
<html>
<body>
<form runat=server>
<asp:Table runat="server" CellPadding="5"
GridLines="horizontal" HorizontalAlign="Center">
<asp:TableRow>
</body>
</html>
:*+= (,8 *7 0. 0#
+
8
TextBox U P0 +$
#, W *7 0. '
<html>
<body>
<form runat="server">
A basic TextBox:
<asp:TextBox id="tb1" runat="server" />
<br /><br />
A password TextBox:
<asp:TextBox id="tb2" TextMode="password" runat="server" />
<br /><br />
A TextBox with text:
<asp:TextBox id="tb3" Text="Hello World!" runat="server" />
<br /><br />
P4
:
.*- $ +$
8
:
K$2 W
W %
=G
+$
8
: # $%&
:(,8 *# 0. ! 9
*4 $ +$
8 •
3,
8 *$ 8 ,72 *# •
+ 04 .,8# P0 A ! <
7+2 * 8 $ 5, 5+
U2 %8 1
? <T + B (,8 2 B (,8 2 , /0
JavaScript ? *$ 2 9
, /0 5$#
.#, 5$# U2 1
7+2 +
,$ 5.
,T2 !? Input Validation +$
8 8
ASP.NET
Input +$
8 A=- + , ,@ +$
8 (4 < 4 $ 5,
.@
T Validation
+ 04 .,8# P0 A ! < 7+2 * 8 $ 5, 5+
,$ 5.
,T2 !? Input Validation +$
8 8
ASP.NET
Input +$
8 A=- + , ,@ +$
8 (4 < 4 $ 5,
.@
T Validation
: +G ! *- +$
8 $2 1
7+2 2 Input Validation +$
8
I
+G Input Validation +$
8 *+ *@ $# *
4 8 •
.$
+ 04 B
C
+$
8 ! %
G
X[ ValidationSummary +$
8 $
! *= I2 *$ ! •
.
&
$ %$
!
'# U 9=+ Input Validation +$
8 •
.$ ,8 - $# !
$ , .1@ 5$# A! & $ < 2 Controls Input +$
8 J
%A ! T
0 =d + 04 H
T + %
9
*
5; $ & K$ , ! 5$# (,8 * 2 $# A=4 1@
.$
T 5, *
[ 3 . ,$ 30 +
&4 9
* $ Validation +$
8 + T
*$ I2 (,8
$ !
8
(,8 *$ 1 0 $# *
4 8 (,8 $# # 2
BaseValidator 9
+$
8 1
1 +
= W
W 8
BaseValidator 9 •
.Validation
+$
8 1
1 +
= W
W 8
BaseValidator 9 •
.Validation
: *7
A Required Value:
<input type="text" id="txtRequired" size="20" runat="server" />
<asp:RequiredFieldValidator id="valRequired" runat="server"
ControlToValidate="txtRequired"
ErrorMessage="* You must enter a value in the first textbox"
Display="dynamic">
*
</asp:RequiredFieldValidator>
+$
8 C $ txtRequiered +$
8 $ @ G X$;
.ControlToValidate (4 txtRequiered [ 30 RequieredFieldValidator
.ErrorMessage *; (4 84 ! G $ <2 @
./ X4 ($ $# ! + *$ +$ 8 + 04 Display $
: B$4 0G 2 +
+$ I
8 !@
U Operator $
( Equal,greaterThan,LessThanOrEqual,..)
! + 7 @ 1 +$
8 *
CompareValidator +$
8 + +
:! *7
! ,
CompareValidator +$
8 2 . X$;
!W, (,8 <8
2 X$; ."27/6/2005" 7 1 txtCompareDate
.Type=”Date”
f
C2 (,8 5 $ * String .
: B$4 0G 2 +
+$ I
8 !@
U Operator $
( Equal,greaterThan,LessThanOrEqual,..)
.7 @ 1 +$ 8 * CompareValidator +$ 8 + +
5 (> , :2 W K;7 $ 0. $
8 $ ! &
.$ 4 \ , $ 77 7 2
MaximumValue
7 Type
(>
.MinimumValue 77
5 (> , :2 W K;7 $ 0. $
8 $ ! &
.$ 4 \ , $ 77 7 2
MaximumValue
7 Type
(>
.MinimumValue 77
-
# "4
:
@ +G X
Validation +$
8 ASP.NET 3,
.ValidationExpression !X
? $ .$ !X
1 ,
8 *
2 +G, X
+$
8 ! *7 !
Universal Knowledge Solutions s.a.l 94
.'$ !
+4
8
. txtRegExpr +$
.
K$ ValidationExpression , .*@.*\..* !X
2 X$;
9
$ I>
+ 8 * 9
$ I2 8
@ +G X
Validation +$
8 ASP.NET 3,
.ValidationExpression !X
? $ .$ !X
1 ,
8 100
+2 @ *4 +G, Comparevalidator +$
8 ! *7 !
: $# CustomValidator +$
.
1 +$
8 '
U2 1 (,82
1, !
+ !0 JavaScript %< 8
.$# !
0. P
4 %
30 5$#
ControlToValidate="txtCustom"
ValueToCompare="100"
Operator="GreaterThan"
Type="Integer"
ErrorMessage="* The Prime Number must be greater than 100"
Display="dynamic">
*
</asp:CompareValidator>
<asp:CustomValidator id="valCustom" runat="server"
ControlToValidate="txtCustom"
ClientValidationFunction="ClientValidate"
OnServerValidate="ServerValidate"
ErrorMessage="* Your knowledge of prime numbers is not optimal"
Display="dynamic">
Universal Knowledge Solutions s.a.l 96
*
</asp:CustomValidator>
<script language="JavaScript">
<!--
// client-side validation function for CustomValidator
function ClientValidate(objSource, objArgs) {
var blnValid = true;
var intNumber = objArgs.Value;
if (intNumber % 2 == 1) {
var intDivisor = Math.floor(intNumber / 3);
if (intDivisor > 2) {
for (var i = 3; i <= intDivisor; i = i + 2) {
if (intNumber % intDivisor == 0) {
blnValid = false;
break;
}
}
}
else
blnValid = false;
}
else
blnValid = false;
objArgs.IsValid = blnValid;
return;
}
//-->
</script>
IsValid *$ (4 @ ObjArgs 6 Value *$ *; +$
8 @ (,8 *$
.& 2 $ '
04 $ ObjArgs 6
? +$
8 (4
=J ; (,8 1 $ /0. !
:Value , + +$
8 @ (,8 I$ ServerValidateEventArgs
blnValid = false;
.
1 +$
8 '
U2 1 (,82
1, !
+ !0 JavaScript %< 8
.$# !
0. P
4 %
30 5$#
Sub Page_Load()
Dim objValidator As BaseValidator
For Each objValidator In Page.Validators
objValidator.Enabled = lstEnabled.SelectedItem.Text
objValidator.EnableClientScript = lstClientScript.SelectedItem.Text
Next
End Sub
8 <
4
:
5
:
.5 %8@ !
5
*$
T %$ %
+ 8 9 W@ @ +$
8
:!"
.+$
8
, *# 0. !
: # $%&
:(,8 *# 0. ! 9
5
2 •
%$ @ (4 +$
8
1 9+ •
8
(4 +$
8
+ 9+ •
+$
8
X4
X
? 9+ •
Universal Knowledge Solutions s.a.l 100
<
C
ASP 58 @ . ,$
! 5
(4 * (4 5 1@ ,T2 P$
5 W; 5 8@ *7 5
U2 1 *& 0. G
% .
X4 ,8 5, G 58 + 5#, XML W7 !
+&
5@ 3, ,
*8> /0. G
+ , + ASP 1 * + .
.*, 4 ! %
- ! 8
*7 5 5$ P0 (,8 +$
8
!
CG 5
2 9_
R
@ *+
X4 5;
3
$, P0 K$ .5 8@ 5;
8
.+$
8 H %
*$ @
2
X- !
I2 +
$ 5;
8
! *$ +$
8
.!,> 5
K$
Visual ! (L) ,
HTTP *+
'& <8
5$ ! 9
COM 5+ IE4 '# 0 .Access Basic
/0. 5 .HTTP *+
1 Access VB ! 3, ,7 5
G 5, ! 5
X ! 3+= +
5
5+ 5+
.!2 *+=
/0. (,8 8& 8 (4 52 5,
(-;
T A=- ADO *7 5 2 5+ f ASP3.0 !
..
X4 ! 5 9# I$ recordSet
P
& 9#
8
+ ,$ ! * (4 L$# (,8 L
+
:! *7 !
X + P
...' assuming we've got a Recordset object containing the data ...
Response.Write "<table>"
Response.Write "<tr><th>Date</th>"
Response.Write "<th>Subject</th>"
Response.Write "<th>User Name</th>"
Response.Write "<th>Content</th></tr>"
Do While Not objRecs.EOF
strDate = FormatDateTime(objRecs("dtDate").value, vbLongDate)
Response.Write "<tr><td>" & strDate & "</td>"
Response.Write "<td>" & objRecs("tSubject").value & "</td>"
Response.Write "<td>" & objRecs("tUserName").value & "</td>"
Response.Write "<td>" & objRecs("tContent").value & "</td></tr>"
objRecs.MoveNext
Loop
Response.Write "</table>"
objRecs.Close
:! !
+ !#+ ASP.NET ! * # A>
<!-- the server control located in the HTML section of the page -->
<ASP:DataGrid id="MyDataGrid" runat="server" />
...' assuming we've got a DataView object containing the data ...
MyDataGrid.DataSource = objDataView
MyDataGrid.DataBind()
7 ! + %
+ 5+ A 5
X4 G + +$
8 ASP.NET
.
5
*; 30 *+ I
.$ 5
8 1 * 5+ 2
(-;
T A=- ADO *7 5 2 5+ f ASP3.0 !
..
X4 ! 5 9# I$ recordSet
P
& 9#
8
+ ,$ ! * (4 L$# (,8 L
+
.P
*
A=[ 04 :<H ASP 3.0 !
C I0 * # AG +$
8
9 *+ I$ ! 9# ,, <8 *> 9 ! *$ AG HTML
+$
8 W * *
? *+ 1 5
!
9 @
X4 2 5$# (4 2 !H
4 1 *7 * (, .ASP:DataGrid
.!
(4
2
4 W @ [
7 ! + %
+ 5+ A 5
X4 G + +$
8 ASP.NET
.
5
*; 30 *+ I
.$ 5
8 1 * 5+ 2
A
!
,+ ! 3, = > ?
.5
? !. ? 2 (,8 &+ # %
=4
+
!
,++ 2 1 ,+ /0. /0#
1 + &
.,+ /0. 5
5
B + & 30+ 5
: =
:09
(4 @ [ T
*$+ +$
8 1
%$ @ + 8 $ /0. F
(4 .4
F $ /0. ! .+$
8 W
,> 0.
R .(VALUE TEXT W ;
< 7) +$
8 .
X ! 8 %
ASP:HyperLink ASP:TextBox <INPUT> *7 %$ @
X ! +$
<
.
:
=
: 8
2 W@
+ *7 * (, .@
7+2 (,8 5
I$ 8
/0. F
.@
7+2
X4 C+ +$
8 1 9# 8
2 8
.ASP:CheckBoxList ASP:ListBox <SELECT> *7 +$
8 $ /0.
. !8 U I2 ! > 5 # F *$ *+ (,8
=
5
$2 2 W
B$4 2 W $2 *7 %$ @ (4 +$
8
8
: c $2 +
<%# property-name %>
:+$
8 (4
+ ! , ,$
%8 3.
.
H
T ! 2 +$
8 ! 2 $# ! 8 \
_ R @ •
.
H
T ! 2 +$
8 ! 2 $# ! 8 \
_ R
%R •
.
•
<
"4
+$
8 1 ; ,@ 5
,+ + !
! $ % +
.
H +$
8
8
$2 @ (,8 *$ + B
2
TEXT [ TextBox +$
8 (4 LABEL +$
8
+ *7 * (,
.LABEL +$
8 ! TEXT , + TextBox +$
<form runat="server">
<ASP:TextBox id="MyTextBox" runat="server" />
+$
8 %0G LABEL +$
8 ! + $# *
4 %
*+ !
A8 !
+ B ,& * 0. - myTextBox ( TextBox
.DataBind
8 I2 ! @ P
- <2 + 04 +$
@ [ /0.
$&
:? ASP:Image +$
8 ! Src , @ A8- *7 * (, .+$
: + ASP:HyperLink +$
URL !
$ $
<ASP:Hyperlink Text="<%# ImageURL %>" NavigateUrl="<%# ImageURL %>"
runat="server" />
. ا>دیHTML ﺵ!اتS ﻡ7* وﺡHTML !"ﺹ# S& ﻡ3N ﻡN3 "<* اX.> ه
<
"4
+$ 8 1 ; ,@ 5 ,+ + ! ! $ % +
TEXT [ TextBox +$
8 (4 LABEL +$
8
+ *7 * (,
.LABEL +$
8 ! TEXT , + TextBox +$
8 I2 ! @ P
- <2 + 04 +$
@ [ /0.
$&
.+$
#
8 !
0 DataBind
$ +$
8
L
.5
1 *, < +$
0 DataBind
+$
8 ! 5
T
82 9
L
.5
1 *,
(,8 &4 & +
/0. .
?
:8
.+$
8 U2 %8 %$ 5
#+ *7 '
>form runat="server<"
>table border="0<"
>tr><td nowrap="nowrap<"
>b><ASP:Label></b> control:
>ASP:Label Text="<%# ImageURL %>" runat="server" /><p</
>b><ASP:TextBox></b> control:
>ASP:TextBox Text="<%# ImageURL %>" runat="server" /><p</
>b><ASP:Button></b> control:
>b><ASP:LinkButton></b> control:
>ASP:LinkButton Text="<%# ImageURL %>" runat="server" /><p</
>b><ASP:Image></b> control:
>ASP:Image Src="<%# ImageURL %>" ImageAlign="middle" runat="server" /><p</
>b><ASP:CheckBox></b> control:
>ASP:CheckBox Text="<%# ImageURL %>" runat="server" /><p</
>b><ASP:RadioButton></b> control:
>ASP:RadioButton Text="<%# ImageURL %>" runat="server" /><p</
>b><ASP:Hyperlink></b> control:
>ASP:Hyperlink Text="<%# ImageURL %>" NavigateUrl="<%# ImageURL %>" runat="server"
/><p</
>b><ASP:ImageButton></b> control:
>ASP:ImageButton ImageUrl="<%# ImageURL %>" runat="server</ "
/>form<
<---------------------------------------------------------------------------!>
Sub Page_Load()
'bind all the controls on the page
Page.DataBind()
End Sub
/>script<
<---------------------------------------------------------------------------!>
/>body<
/>html<
8 .2
7+2 ' + 5
+ .%# %$ 5
,8
F
2 W;8 5 %8@ 9# 8
*7 .
X4
! %
+ 9#
.@ #
8
3, K$ %
+ 1 *, B
W@ +$
8 !7 ASP.NET
2
X4
8 A=[ H %
7 .5
*& ' !
W
.5
9 *+
X4 9
8 A=[ I0 <SELECT> W@ +$
8 0G 30 (,8 *7+
.5
9# 1
X- <OPTION>
X- # HTML I2 + (4
8 ! /0. ! $ 5 $2 ,
4 (,8 %
1 X#$ 1) +$
8 *@ !H *+= /J=4 I
04 0.
.(
$ $ P
HTML
8
:
< # C
:
5
& 7
!,
system.web.ui.htmlControls.htmlSelect 9 . <SELECT> +$
8 •
system.web.ui.WebControls.ListBox 9 I0 ASP:ListBox +$
8 •
9 I0 ASP:DropDown +$
8 •
system.web.ui.WebControls.DropDown
9 I0 ASP:CheckBoxList +$
8 •
system.web.ui.webControls.CheckBoxList
Universal Knowledge Solutions s.a.l 112
9 I0 ASP:RadioButtonList +$
8 •
system.web.ui.webControls.RadioButtonList
system.web.ui.webControls.Repeter 9 I0 ASP:Repeter +$
8 •
system.web.ui.webControls.DataList 9 I0 ASP:DataList +$
8 •
system.web.ui.webControls.DataGrid 9 I0 ASP:DataGrid +$
8 •
8 .2
7+2 ' + 5
+ .%# %$ 5
,8
F
2 W;8 5 %8@ 9# 8
*7 .
X4
! %
+ 9#
.@ #
8
3, K$ %
+ 1 *, B
W@ +$
8 !7 ASP.NET
2
X4
8 A=[ H %
7 .5
*& ' !
W
.5
9 *+
X4 9
8 A=[ I0 <SELECT> W@ +$
8 0G 30 (,8 *7+
.5
9# 1
X- <OPTION>
X- # HTML I2 + (4
8 ! /0. ! $ 5 $2 ,
4 (,8 %
1 X#$ 1) +$
8 *@ !H *+= /J=4 I
04 0.
.(
$ $ P
HTML
8
:
< # C
:
5
& 7
!,
system.web.ui.htmlControls.htmlSelect 9 . <SELECT> +$
8 •
system.web.ui.WebControls.ListBox 9 I0 ASP:ListBox +$
8 •
9 I0 ASP:DropDown +$
8 •
system.web.ui.WebControls.DropDown
!C"
$ "
(,8 I$ I0 5
8 2 *$ $ DataTextField
*7 * (,8 ..
X- F !
, +<OPTION> +$
8
ListBox.
! I$ I0 5
8 2 *$ $ DataValueField
*
2 F VALUE
!
! *7 * (,8 .+$
VALUE
<OPTION> +$
ListBox.
%$ 1 9
$ ,, $ DataTextFormatSt
ring
C4
=R *$ 2 DataTextList 8
*7 * (,8 .
/0.
X4
‘{0:C}’ 2 , ‘{0:dddd MMMM
dd,yyyy}’.f
A$ 8
! 9# 8
$ DataMember
* (,8 .9# 8
7+2 (,8 5
T 1
8 *
*7DataSet.
Universal Knowledge Solutions s.a.l 114
B& :
5 1 ; *@> (,8
‘%
+ 1 *, F +$
8 1
:
$
5 +$
8 A*
*#
I2 5
DataBind
8 '
A72 C @ I0
.+$
8
+$
8 (4
=J %& R
FindControl
.
+$
8 &
:
#
" B9
+$
8 U , W@ +$
8 @;4 ! K$d 1 *
3.
:5
W +$
8 U2 +
= 7$ 3. *$ *+ (,8.
9 K$
! 9 *+ *
2 K$ 0.
X
9 B$
.5
K$ K$ 5; K$ (4 DataBinding
A72 9 5 * $ +
.5, +$
8 A*
$# *
4 8 K$ 0.
X
. ‘ (4 %
1
SelectedindexChange
5
? A
[ !
, '
. 5
+
X- (,8
! 5
U I2 (4 W +$
8
# $ +
W +$
8
^ 2 , $ ! 0. . IListSource 2 ICollection IEnumerable
:(4
+
T ! *
8
2 Request.Form 6 8
*7 Collection •
#G .G=F 8
I2 2 Dataset
X4
+ 04 <8 %
!. . 8
I$ !. :ArrayList •
;
< 7 ListBox ! 5
+ .Dictionary
? *$+ \#
8 4 * +
8 I$ :HashTable •
9, K$ W +$
8 $ ! 7 /0. 5
*
@ \#
8 *+
8
8 84
8 /
X4
,.G I
DataTable
T2 9# (,8
? 0. I$ :DataView
T •
!
8 < ,.G .J=4 I
2 5 %8@
+ .5 %8@ 1 $ /
%A
, *
I0 :DataReader
T •
. Dataview
T 1 *$ = %
C * 9# 8
2 9 I$ 2
! U
2 DataReader
? A2 + K$ A>
T> DataReader
? %< 8
5&$ ,T2
U 5
+ *$ !# .*$
7+2 (,8 %
+
5
I$
@ + 2
DataReader U + 2 @ \# (,8 I$ I0 HashTable
.C4 +$
8
*$ 2 $ (,8
* (, .W !
8 *+ @
7+2
X4 (,8 %
@ W +$
8
7+ +
, @ <OPTION>
B$ @ <SELECT>
! 1 *7
.
0 VALUE
<Select>
<Option Value=”Value1”> Text1</Option>
<Option Value=”Value2”> Text2</Option>
</Select>
DataGrid DataList Repeater :!. 8 ! ASP.NET ! +$
8 +
.C 5
5, 1 @ 8 '
/0. I> + C,8
Key:<%# Container.DataItem.Key%>
2
Value:<%Container.DataItem.Value%>
2 *$ $ DataReader 2 DataView 2 Collection
T2 1
8
:C#
U 5
+ *$ !# .*$
7+2 (,8 %
+
5
I$
@ + 2
DataReader U + 2 @ \# (,8 I$ I0 HashTable
.C4 +$
8
*$ 2 $ (,8
* (, .W !
8 *+ @
7+2
X4 (,8 %
@ W +$
8
7+ +
, @ <OPTION>
B$ @ <SELECT>
! 1 *7
.
0 VALUE
/0. $ * A72 W @ & 8 & ! +$
8 8
(DataTextField ) P
! /
X4 I0 5
*$ W
.(DataValueField ) +$
%
.X
T ! I0 *$
<select id="MySelectList" runat="server" />
:!
Page_Load K$ V ! 9 7
MySelectList.DataSource = tabValues
MySelectList.DataValueField = "Key"
MySelectList.DataTextField = "Value"
MySelectList.DataBind()
X4 H %
5
*$ $ !+ *+= <+0 DataGrid +$
8
DataSet DataView Array . 5
+ 8 *$ 0. * . 1
/0. $ * A72 W @ & 8 & ! +$
8 8
(DataTextField ) P
! /
X4 I0 5
*$ W
.(DataValueField ) +$
%
.X
T ! I0 *$
X4 H %
5
*$ $ !+ *+= <+0 DataGrid +$
8
DataSet DataView Array . 5
+ 8 *$ 0. * . 1
Eval
#
5= 2 !
,72 ! +$
8 ! 5
,+ I$ 2 +
: 8
<%# Container.DataItem (“FieldName”) %>
@ $ W= 5= $2 DataBinder
? Eval
R
..
X-
' .9 @
7+2 (,8 CW$ *$ ! 5
B <W= ,8 9 & < ?, <
(>
T ! 9 BookTitle (
! *7 ! .A> U
:DataView
<%# DataBinder.Eval (Container.DataItem,”BookTitle”) %>
(4 (,82 *$ ,
G
(8 Eval
. ,
@ $ W= 5= $2 DataBinder
? Eval
R
..
X-
' .9 @
7+2 (,8 CW$ *$ ! 5
B <W= ,8 9 & < ?, <
(>
.A> U
(4 (,82 *$ ,
G
(8 Eval
. ,
$
= ! /
0. .
X4
%W Eval
5
7+2
.
:EVal
"4
: 4
T P
$ I0 formatString .
> + 5; K;7 Eval
0G
I0 5
PublicationField *$ B$ $ 1 *7 * (, .I
4
:? !X f
/
X4
@
+ 2
K$
*+ ! %$ @ (,8 *$ 1 Eval
8
9
$ 2 (
*$ I0
?, +
$ ) <W <
# *>
. , 8
I0 !
T P
$ I0 formatString .
> + 5; K;7 Eval
0G
.I
4
@ 30 %
+
,
I0 P
$ , Datalist Repaeater (4 2
. <ItempTemplate> P
[
HashTable "4
8
ItemTemplate $ > 5
DataList Repeater +$
$
.5$
X4 9+
MyDataGrid.DataSource = tabValues
MyRepeater.DataSource = tabValues
MyDataList.DataSource = tabValues
$# !
1
,8 ( &2
1
Page.DataBind() 'bind all the controls on the page
End Sub
:DataView @
E 0;
=
8
<%@Page Language="VB"%>
<form runat="server">
</form>
Universal Knowledge Solutions s.a.l 131
<!--------------------------------------------------------------------------->
Sub Page_Load()
MyASPList.DataSource = objDataView
MyASPList.DataValueField = "ISBN"
MyASPList.DataTextField = "Title"
End Sub
</script>
<!--------------------------------------------------------------------------->
</body>
</html>
<%@Page Language="VB"%>
<!-- Unlike the DataView we can only bind a object DataReader to one control -->
<!-- after it has bound the data the reader is at the end of the source rowset -->
<b><ASP:DataGrid></b> control:<br />
<ASP:DataGrid id="MyDataGrid" runat="server" /><p />
<!--------------------------------------------------------------------------->
Sub Page_Load()
Try
'create a new Command using the connection object and select statement
Dim objCommand As New OleDbCommand(strSelect, objConnect)
'execute the SQL statement against the command to get the DataReader
objDataReader = objCommand.ExecuteReader()
End Try
End Sub
</script>
<!--------------------------------------------------------------------------->
</body>
</html>
P0 +$
8 *+ (4 4 <input> !
1
0G *7 !
.input ! $
:/2 *
!
X + ! W
$ "
+$
#,
X BackColor, BackImageUrl
P
#, A
> $ HeaderStyle, ItemStyle, FooterStyle
AlternatingItemStyle
.
*0 2
+ +$
8
:5)
!
<%@Page Language="VB"%>
<!--------------------------------------------------------------------------->
Sub Page_Load()
Try
'create a new Command using the connection object and select statement
Dim objCommand As New OleDbCommand(strSelect, objConnect)
'execute the SQL statement against the command to get the DataReader
objDataReader = objCommand.ExecuteReader()
End Try
End Sub
</script>
<!--------------------------------------------------------------------------->
</body>
</html>
< "4
9
(4 @ 4 ! W +$
8 P
X +$, 7
,
.+$
8
.
X4 9+ .
X4 ! %8> $ 2 , +
9
(4 @ 4 ! W +$
8 P
X +$, 7
,
.+$
8
.
X4 9+ .
X4 ! %8> $ 2 , +
:5)
!
<%@Page Language="VB"%>
</style></head>
<body bgcolor="#ffffff">
<span class="heading">Using a Simple Template with a Repeater Control</span><hr />
<!--------------------------------------------------------------------------->
<HeaderTemplate>
<div class="rHead">
Some of the Latest Wrox Books from Wiley<br />
<img src="images/redrule.gif">
</div>
</HeaderTemplate>
<ItemTemplate>
<div class="rItem">
<img src="images/<%# Container.DataItem("ImageURL") %>"
align="left" hspace="10" />
<b><%# Container.DataItem("Title") %></b><br />
ISBN: <%# Container.DataItem("ISBN") %>
Published: <%# DataBinder.Eval(Container.DataItem, _
"PublicationDate", "{0:d}") %><br />
<%# Container.DataItem("Precis") %>
</div><br clear="all" />
</ItemTemplate>
<SeparatorTemplate>
<img src="images/redrule.gif">
</SeparatorTemplate>
<FooterTemplate>
<img src="images/redrule.gif">
<div class="rFoot">
For more information visit <a href="http://www.wrox.com">http://www.wrox.com</a>
</div>
</FooterTemplate>
</ASP:Repeater><p />
<!--------------------------------------------------------------------------->
Sub Page_Load()
Universal Knowledge Solutions s.a.l 143
'create a new empty DataTable object
Dim objTable As New DataTable("NewTable")
objDataRow = objTable.NewRow()
objDataRow("ISBN") = "0764543636"
objDataRow("Title") = "Beginning Active Server Pages 3.0"
objDataRow("PublicationDate") = "July 2000"
objDataRow("ImageURL") = "3636.gif"
objDataRow("Precis") = "This book is for beginners who have no previous experience " _
& "of ASP, C#, XML, object-oriented programming, or the .NET Framework. A little " _
& "knowledge of HTML is useful, but by no means essential as all the concepts that " _
& "you need in order to create dynamic ASP.NET web sites are presented and explained in full."
objTable.Rows.Add(objDataRow)
objDataRow = objTable.NewRow()
objDataRow("ISBN") = "0764543695"
objDataRow("Title") = "Beginning ASP.NET 1.0 with Visual Basic.NET"
objDataRow("PublicationDate") = "February 2003"
objDataRow("ImageURL") = "3695.gif"
objDataRow("Precis") = "This book is for beginners who have no previous experience of " _
& "ASP, VB, XML, object-oriented programming, or the .NET Framework. All the concepts " _
& "you need in order to create dynamic ASP.NET web sites are presented and explained in full."
objTable.Rows.Add(objDataRow)
objDataRow = objTable.NewRow()
objDataRow("ISBN") = "0764543962"
objDataRow("Title") = "Professional ASP.NET 1.0, Special Edition"
Universal Knowledge Solutions s.a.l 144
objDataRow("PublicationDate") = "February 2002"
objDataRow("ImageURL") = "3962.gif"
objDataRow("Precis") = "This book is for people that have a solid understanding of ASP " _
& "and are familiar with VB or C-based syntax. It will show you how to develop sophisticated " _
& "ASP.NET applications using the .NET Framework with its comprehensive and in-depth guide " _
& "to this exciting new technology."
objTable.Rows.Add(objDataRow)
End Sub
</script>
<!--------------------------------------------------------------------------->
</body>
</html>
:
5 K$2 $ %
4
:
.K$ ,
$
:!"
6 *6 !6 6] (6,8 6,
/0. ! 9
. W ! 2 ,8 $ 5, %
4 X#$
. 5 K$> (,8 9
+ $ 1 ASP.NET
: # $%&
:(,8 *# 0. ! 9
$ %
4 # •
ASP.NET ! $
T2 •
ASP.NET ! K$2 •
*8# ,$
*; 2 %$ *;
T2 2 @ (,8 X$ G $ %
4 9_
F
. 1
*8# ,$
*; 2 %$ *;
T2 2 @ (,8 X$ G $ %
4 9_
F
. 1
.
? 0. (4 *, *W
2 ASP.NET
I0 Session
? $ (,8 A- +$ :(Session) $ L
5 + .$ (@ 20 + %8) %$ % 5 (,8 A- '
.
H
? 0. 5 8 < Session
T
.
X[ @ ! ;8- 5 1
2 04 Session
? + *7 * (,8
5 $; ! *; 1@ 1 *8# 0[ .
. 0 0$
? *; ,8 A- $ +$ :(Application) $ L
1
$ 5 /0. + . 5 (,8 X#$ ' I0 Application
.(... 5 5$#)
*8 + .Cache
? ,$
$ +$ :(Cache) , ,$
$ L
I2 C4 * + I2 3
= C+ ! Application
?, C= Cache
?
T *.G 2 , @ *7 * (, .4
? 0 2 &4 .
2 1 .8 ‘ *?= A 8 XML 9, ASP.NET 5$# 1
! .5
XML 9, (,8
? 0 <
=J G= Cache
?
? 0.
.5
? C,8 5 I0
$; A?[ 30 ASP.net $ 5 9,
? *$
Universal Knowledge Solutions s.a.l 147
$2 + Cache Application
? (4 - :+ 5&$ L
'
+ K$ .+ 5&$ !. ASP.NET ! C
T W ! 5;
I0 9 f 8 + 5
? /0. %$ A=4 .8 + 5
? 8
./J=4 B
? %W
7+2 + 5&$ !
8 5
? /0. (4 * +
.Application
5,$ .ASP ! 8 $ ASP.NET ! Session
?
F
:!. 58 ! *+= 8
Session
?
7+2
8 %
8 !. (farm – 5 8
) ( 8 •
! , /0. 5+ .%
*+ ! 9, , *$ I
2 + K$
. (,8 <,$ ,
5, + ;
< , $> !
.Session
T> 5, $ 3
=, 5 84 2 + %
! 2
(4 * 1 0. + 04
H (4 , *$ & $ /0. !
.,
5,
.
*@ 5++ 8 2 *# ($ Session
? 8 •
1 * .ASP.NET *+ 5 < Session
? +
.\#/@ %8@ (,8 5 I
HashTable
?+ Session
?
:C# ! = ?
Session [ “[string key]” ]=Object;
T ! “Hello world” 9
$ , ,7 %
2 04 *7 * (,8
:+ !#+ “SimpleSession” \# Session
Dim sessionValue As String
sessionValue = Session("SimpleSession")
Universal Knowledge Solutions s.a.l 149
:C# !
string sessionValue;
sessionValue = Session["SimpleSession"];
$ *$ (4 P$
T> 9
$ *; 8 #, d 2
,
T C /A=[ @ 9 %
2 04 *7 * (, . ,
: + PurchaseOrder
? +
Dim po As PurchaseOrder
po = CType(Session("po"), PurchaseOrder)
: + C# 2
PurchaseOrder po;
po = (PurchaseOrder) Session["po"];
.PurchaseOrder 9 $ (4 I @ *$ , @ 2 X$;
5&$& 8
3. .Session
? 5, $ ! Mode •
.inproc off stateServer sqlserver + ,
? *+= %$ (,8 *+ 8 5, Session
? +
., +
= 5, + Application
. *+ +
=
A=[ T
$ ! < <
# 3
= 0. +
5W7 *+= (,8 5 04 s+ HashTable
? Application
T
.@\\#
* ASP.NET A
4 8 ,# %
5 # Application
? 8&
1
* C8;@4 %84 2 B
2 %
A
- 0. %84 ,8 5 0[ A
- 5
.C 5
+2 8
(,8 ,$ + ;&
8
! + $ (,8 . +
.U
& ,8 -
H A
4 A8 U
2 A
- # 5, U
>
:!, = ? *; Application ? 5 %A @ +
:VB.NET !
Application (“HitCounter”)=1
:*+= C#
Application[“HitCounter”]=10;
:*+= ? 2 !#+ Application T ! %A @ 2 04 C= *+=
:VB.NET !
Dim hitCount as integer
hitCount=Application(“HitCounter”)
:C# !
Int HitCount= Application[“HitCounter];
,8 I2 A
4 B
> 5 1 2 ; *#@-
2
.!$ 2 *@
? 0.
$ $ 5,
$ 2 K$
(,8 $ X#$ Application
? + !8
+
? +
= 5 5+ 04
.!,72
T ,T>
: C# !
public void Application_OnStart() {
Application["HitCounter"] = 0;
}
public void Application_OnBeginRequest(){
Application.Lock();
int tmpInt = (int)Application["HitCounter"];
Application["HitCounter"] = tmpInt + 1;
Application.UnLock();
}
8 Application
?
$ <W, ASP.NET Unlock
A8 8 *$ !
. G
X *$ ! 2 , , A 2 , , A &
9, %A
@ ! *$ !. + .%
7+
$ +
. %
+0 0. XML 9, *7
? .8 I
04 .5
* I$ XML
j5
* *7 XML 9,
? *$ ! *$ I0
Session
T> 1 # + G
/0. :
:*+= ? + @\\# P> Application
:VB.NET !
Universal Knowledge Solutions s.a.l 154
Dim productDataSet As New DataSet()
' Populate DataSet
Cache("products") = productDataSet
:C# !
DataSet productDataSet = new DataSet();
// Populate DataSet
Cache["products"] = productDataSet;
8& 5@;+ 5@;8 $
/0. ' .Insert()
: $
:? ! +
:VB.NET !
Dim productDataSet As New DataSet()
' Populate DataSet
Cache.Insert("products", productDataSet, Nothing)
:C# !
DataSet productDataSet = new DataSet();
// Populate DataSet
Cache.Insert("products", productDataSet, null)
.Insert() * $ ,T> (,8 Cache ? 8
8 @;8 A=4 + C2 04 % T ! H 8& (,8 ! $; A
:*7 . %$ %
# 9, Cache
?
B
> 5, ] *
? , Cache
? , 5, *7 !
X
+G 9+ X$; . ] U 0 ,
# + XML 6 ,
XML 7 ? (4 C,$ C 9+ Cache
?
9,, *$ XML 7
T - UpdateCache W
- + 9+ 2 .CType
G
CacheDpendency
T $ Insert() , Cache
T (4
8 @;8 A=4 + C2 04 % T ! H 8& (,8 ! $; A
?Cache .
? #
H \# 2 %$ X$ 9,
8
0 + .XML 9,
T (,8 Cache
? A$ @
#+ $
= ! *7 '
.
? 0.
H
8 * 8 Cache
?
7+2 2
8 4
2
.<2 XMl 7 Cache ? 5 4 (4 @ % 0.
2 (,8 84 A=4 + \# 2 (,8 8& 9, 2 (,8 8& (4 -
.
:8
/0. K$ I
C2 ,8 5 %8@ $ *
! + 8 1
2 04
Cache
? 5 /0 *7 Dataset
? P
2 + U> ! %
5
.@ 60 ! $; 1 $
%
(,8 K$
X *$ ! ($ C2 1 , *+ 8 5 %8 *&
> 0. ,8
. 8 *; 7$ + ! 5 [ 5
:
B&
.CX !
0# +$, %
K$>
:
X
:
B& "4 < 4
: Global.asax $ 52 59 >? "4 /
! I
+
/0. C= .K$d !> P0 9, [ $ /0. !
2 Application_OnStart *7 K$> 5
+ I
5+ K$ Asp.Net 9, Asp
.Session_OnEnd
: Http
/
ASP.NET *@ C *@ Http , (,8 *, *
Http %$
. ASP.Net *,$
$ 5$ /0. 1
59 >? :
B& A
VB.NET !
Public Sub Application_OnStart(sender As Object, e As EventArgs)
End Sub
:C# ! 2
public void Application_OnStart(Object sender, EventArgs e) {
}
I0 EventArgs * (4 4 K$ ;[ @ I0
? C @ ! * $
.K$ 0. 8 *# 5, K$ ,2 I0
?, *
'
:C# !
public void Application_OnStart() {
}
,# ? *# 30 Sender 2 EventArgs (4 * ? ! + &
.*2 +$ + >
59 >? :
B& A
:
4 B9
(4 C
, *+ A72 @;4 ! K$> G ,, K$2 9_
F
: , K$2 *7 ASP.NET
C
, *+ 1 K$ 0. ;4 I
: Application_OnBeginRequest K$ •
I0 ASP ! Application_OnStart 9G K$ 8 K$ 0. 9, .ASP.NET *@
. *?= 8 %$ %
C@;4
, V I2 + 2 *@ 2 2 $# I2 *@ !
0# K$ 0. +
. , I2 (,8 * A HTTP
59 >? :
B& A
:Application_OnAcquireRequestState K$ •
2 ASP.NET A
4 * ,
5 !, %.
ASP.NET ' 8 K$ 0. ;4
.SQLServer 2 C
? 30 @ *.G + ;
< 7 XMLSession
?+ Session
T
@ 04
.K$ 0.
. ;
< .J XmlSession
? + 2 $#, , , 8
:Application_OnPreRequestHandlerExecute K$ •
V . V 0. + 5&$ X ! . , V A8 *@ K$ 0. ;4
.Page
. , HTTP V , Application_OnPreRequestHandlerExecute K$ ;4
. ,
A & ! K$ ;4
K$ ,
5
$ K$ 0. Application_OnReleaseRequestState K$ •
.,
5, K$ + & K$ 0. ;4 ., 8 5,
+$ ' C@;4 I0
> K$ . 0. :Application_OnEndRequest K$ •
.
& 1 HTTP 5
*
4 *@
59 >? :
B& A
' 8 , + , *+ 1
+ ! K$> 8
(4
H 7$ 3.
. (4
4 %.
5
$ &4 (4 5 *
[ 2 2 ! Buffer !W, *+= ASP.NET *^#
.%.
5 /0. '
:
"
7 B9
*+ 1
+ ! K$> , *> :ASP.NET ! K$> #
+0
.
= K$> ] !? ,
. ,
*;
X & 2
X 2 + ! K$> G
= K$> 9_
F
X 8 2 Application_OnStrat K$ , (> %
, *?= 8 *7 * (,
. Application_ErrorO K$ , ! G
,
A 8 (,
A K$ *) K$ 0. ;4 :Session_OnEnd K$ •
. *
,
5 ! *
, 2 ,
5, X#$ K$ 0. + .
. 5 %8@
0.
. G
X 8 K$ 0. ;4 :Application_Error K$ •
8 5;# X
*
4 !
A> ! 8 C> .> = K$
.G
8&
<Script runat="server">
Public Sub Application_OnEndRequest(sender As Object, e As
EventArgs)
Response.Write("<hr size=1>")
Response.Write("<font face=arial size=2>This page was " _
& "served by ASP.NET</font>")
End Sub
</Script>
“This page was …” %
X- Response.write
/;82 *7 !
:"4
"
8
2 0 . , *
$ # 1@
.
8
8
*+
Bronze Silver Gold !. 58
(4 $
2 04 ;
< 7
.@ 58
, $
T
(4 * A&J.
F"& )#
. 5 A CLR + CLR * Asp.Net 5+
5+> /0.
+ .CLR ! > $2 Try/catch
5A7&
.*,
7+ I$
A 1& /0. .
!
/0. 9,? 2 + + . %A
5 %8 *& <
< + @ *7 * (,
G 0.
*& + 8 *$ ! + .8 try/catch ,+ ! !
. %
*?= G+ /
X4 j try/catch ,+ P
A7&
X 04 *$ I0 +
.C + I0 * 8 C+ 8 G 8 *#
0. ! 9# > System.Diagnostics A> A
/;82 *7 ! @
.K$> *
+ A#
.5&$ 8
A=- Application_OnError K$ . @
./A=4 (,8 * /
0[ .SourceExist()
K$d *
+G @ 7
P
- WriteEntry()
@ Log EventLog 9 *7 A=[ . @
.Windows K$2 *
.Web_Errord ( K$> *
C,
! G I2
X *$ !
9, ASP ! <
60 , @ ,8 A>
2 10 + G . X$; &
.ASP.NET
:
.NET ! 5 %
4
:
.
%
=G #
T
2 *
:!"
5+ A 5
+ 8 1 * 5 %
[ ' ! 5 @ 8
.NET
.XML W7 *7 W7 2 W;8 5 8 ,7
/0.
: # $%&
:(,8 *# 0. ! 9
#+ (,8 NET. ! 5 %
4
T2 •
. .ASP.NET ! 5 %
[ , 1 ,
,
/0. ! !?
.
B
2 5 5#, ! 5 (4 * 5,8 5 %
4
.
*"
5,
- ! !
5 (4 * 5 ( ! 9# 8
NET. *8
4
.NET 1 ; <
: * C
0;
8 & *8> X ! 5 *8 5H 5, 5
? %
> 5 !
W7 !
+&
5 8 5 5$2 +
W; 5 %8@ #
.<2 5 8@ B
2 W +2 +
.NET 52
;
%
4
T2 1
9+ B
.NET! 5 %
4 9# 1
8 8 $ A8[ 2
.NET ! ,+
W 1 5
:F49 F2
ado.net , %8 , system.data A> A (,8 W; 5 %
4 9# 1
(F
:! *
! %
A> 5A (,8
$ F49 F2
(4 *, >
T> 1
System.data
/0. .W; 5 8@ ! 5
Universal Knowledge Solutions s.a.l 171
.DataRelation DataTable Dataset :
T>
5
8 ,
T> /0. *+ +
.
0 * !
B
>
T> > 9# I$ System.data.com
mon
OleDb A> A
T>
0. A> A
& 8 %
.SqlClient
. !
5
1 *; F !
T> I$ System.data.OleD
b
OleDbConnection *7 Ole-Db
W
T> /0. K
.OleDbCommand
+
= 9#
1 *; + !
T> I$ System.data.SqlCl
ient
SQL
5
8 5
5 [ *2 A2
K$ . Server
T> K
.OLE_DB * ,
9# SQLCommand SQLConnection *7
.K$>
W OleDb 6+ +
=
8@ ! 5 2 & ; 9# I$
3, 8 #,SQLServer *7 W; 5
SqlMoney. SqlDateTime
TG+ .NET ! System.Data.SqlT
.SqlBinary ype
*, X$, *+= A>
T> /0. $
.5 2 *$ A2
%
4
T2 1
9+ B
.NET! 5 %
4 9# 1
8 8 $ A8[ 2
.NET ! ,+
W 1 5
Universal Knowledge Solutions s.a.l 172
.NET 52
;
&
< XML 5#, 1 *, + 9# (,8 $ A> 5A ,, <2 3.
.System.Xml (,8 A> /0. + W; 5 8@
< # *. F49 F2
4
A> 5A 2 .NET * 4 9# + T2 ! 5$#, &
?
8 A=4 $+ B
2 A2 5A
&
5&$ 3.
+ .System.Data.Common A> A
,8
K$ DataTableMapping
! U> 5 2
8 System.Data.SqlType
,8
SqlServer C
. $ !W
T (,8 LADO 5 !L 5 (4 , *
58
:! , 5+ Recordset
OLE-DB
8 ODBC 2 OLE-DB 5 %8 * G •
G= *& (,8
2 0# •
& RecordSet
T 5 •
Connection
T
8 2 Command
? 2
0 + •
%
=
? W
4 2 SQL %
8 0# + 5 * 2 P
- •
Recordset
? Command
? Connection
,8 ,8 A72 5, ,> *$ 5, (,8 DataSet
? *
*+ I$
.$& 5@ ! 5 (4 5 (,8 5; I2 *
4 + K$
5 (,8 $ XML 7 5, *$ 1 C$ (,8 DataSet
? X$
.'$ ,+
: @
E9 449 :
SqlConnection OleDbConnect *& !
T *+ ,
T> .2
$
*7 $ 58- 5
(4 * '# Open
ConnectionString , *& 5, $ !
.C
.5
1 !$ *& ;T[ Close
T 5
1 ,@ 2 Transaction BeginTransac
tion
.,@ A?4 2 - C + I0
:8
' SQL Server Provider Sample
Dim connStr As String = "data source=(local);” & _
“initial catalog=Northwind;user id=sa"
Dim cnn As New SqlConnection(connStr)
cnn.Open()
' Use the connection in here…
If cnn.State = ConnectionState.Open Then
cnn.Close()
End If
9
!
> 0# CommandText
9
*& Connection
ExecuteNonQ
,+) 9# I2 & ;Update Delete 2
uery
Insert ! 9# 8 8
'$ @
%84 I
.(
.;& 0 5
7G
! 9
> 0# CommandText
! 9
*&Connection
/0. .
ExecuteReader
Treader 5 %8@ ! 9# 8
1 *
.9# (,8 *$ ' *+=
! 9
> 0# CommandText
! $ *&Connection !. %$ @ .
. ! 9# 8
*>
*> ExecuteScalar
/0. .% B
> 1
*.4 ;&
. %$ @ %84 , + 8
:*7
' OLE DB Provider Sample
Dim strSQL As String = "SELECT * FROM customer”
Dim cmd As New OleDbCommand(strSQL ,cnn)
:DataAdapter @ E&
$
> 0# SelectCommand
? *.G DataSet Fill
K$ <2 + + .5
5
oda.InsertCommand = cmdInsert
. *
5@; W, !> \# + 58
<2 3.
8 $ @ 8 *
X#$& $ ! DataTable
T2 1 DataSet
T2
!W
5 ! 5
? 57 \, !2 ,
> 0.
04 ,$ 2 .A=4
. % W ! >
:*7
Dim connStr As String = "Provider=VFPOLEDB.1;Data Source=“ & _
“C:\SAMPLES\DATA\TESTDATA.DBC"
oda.Fill(ds, "ProductInfo")
5@; *
(,8 ,$ 5
? 1
57 [ AcceptChan
ges
T DataSet 0# %
H 0 2 ,$ 2 0
AcceptChanges.
T
/0. DataSet ! 5
? *+ 2 I$ GetChanges
0# %
H 0 2
? *$ 0 5
AcceptChanges.
0 2
? *$ 0 5 (,8 5; I2 5 04 $ HasChange
s
0# %
HAcceptChanges.
*
! (,8 5 ! 5; 1
*.[ O RejectChan
ges
TDataSet
0# %
H 0 2
? *$ 0
AcceptChanges 1 (4 5,
/0. .
.5
? 8 5, 1
* !,>
:DataTable @
A
T *+ DataTable
?
8 DataSet
T ! %$ *
(4 * +
DataRowCollection
T (4
=J Rows ( 3, DataTable
.DataRow
T2 8
8 %
8 .
:DataTable @
E9 449 :
Universal Knowledge Solutions s.a.l 183
*
*
*+ 1 * ' !
W 8
DataTable
?
AcceptChanges Clear
!. <
7+2 .B$ (,8 DataSet
T
*
(,8 2 &4 DataSet
? 8 ! 3, !. RegectChanges
! B
>
8
3. 2 + .DataTable
? C4
=J I0 *
. $
:!. *
5$ 1 * '
9
9 (4 *4 K$.*
! 9 A=[ NewRow
. !
. #
!
> 8
%8[ Select
:8
End Sub
</script>
<html>
<head>
<title>Using DataAdapter – in dot net</title>
</body>
</html>
:DataRowCollection @
A 449 :
Rows .$ DataTable
T 9# 8
+0 +
? 0. *7
.
? 0
A 9
- 9# 4 2 -
8
DataRowCollection
T
.*
, !> \# @ (,8 (Constructor)
9
NewRow
/J=4
*
[
/0. Add
. *
(4 (DataTable )
*
%$ DataRow
T2 [ Remove
*
! C@ * $
[ Remove
At
9# !W
\# @ # 0G
/0. Find
.DataRow
TG+ *
! ,
:DataRow @
A 449 :
0. 3, .DataRowCollection
? *
C0 $ 9 *7
? 0.
! ;7 C I0 * # ! RejectChanges AcceptChanges
?
Universal Knowledge Solutions s.a.l 185
1 *,
8
? 0.
/0. (4 4 .DataTable
?
.*
$ 9 ! 5
9
A?4 2 X#$
$ (4 9 *$ BeginEdit,
EndEdit,
.
$ 1 ! 5 (,8 5
? CancelEdit
C4 + 90$ 9+ 9 Delete
.Update 2 AcceptChanges
0# $ *
*
9# 8
%8[
/0. GetChildsRows
. @; 9 0
.9 0 G $ %84 SetColumnError
GetColumnsInEr
HasErrors W 1
/0. K$
ror
.G +2 $ 2 I
$ RowError
:8
:8
Dim strSQL As String = "SELECT * FROM Products"
Dim sda As New SqlDataAdapter(strSQL, connStr)
Dim ds As New DataSet()
sda.Fill(ds, "ProductInfo")
ADO.NET @ E&
ADO.NET @ E&
:8
8 .NET *8
4
. 5 *; 5 5 .NET < 2
+
: 5 8
$ * 4
OLE-DB * SQLServer SQLOLEDB
OLE-DB * ORACLE MSDAORA
OLE-DB* Access
Microsoft.Jet.OLEDB.4.0
! 5Jet
8&
<%@Page Language="VB"%>
Try
End Try
End Sub
</script>
@ W; 5 (4 *, .NET *
4 ! %
8 < ,+
.ADO 1 5+ ! , 5 1
Universal Knowledge Solutions s.a.l 194
0 .5 *@ .8 (,8 > ?, 8
XML ? 5$2
XML ? .NET 8 !
(,8 A
0. ! +
.7
(DOM) XML
;
< + <8
T> /0.
5#, XML *+. XML W7 1 *, 5
8 XML J* 8 .NET 5
:XML W7 1 *, !
T> ' !, . >
Document @ E&
:Document @ E9 449 :
C+ CreateNavigator
T %W 50 8
XPathDocument
? 3, &
8
Document
?
] 8
$ ! .XPathNavigator
? 1 *
0.
+0 4 .W3C DOM
! %$ 3, !. W
,+
!. XML W7 1 *,
+ *+= ! W
%# 8
8
.%
8 (4 * U2 A=-
9
*7
(,8 <8 XML 7 ! %8 A=[ Createxxxxx
x
CreateComment CreateElement
f4...CreateTextNode
%8 *7 XML %8 8 ,7 A=[ CloneNode
Element
.*+ ID # @ %$ %8 %8[ GetElementB
yId
*+ %
=G %$ %8 %8[ GetElements
ByTagname
( #
) Document @
E9 449 :
/A=[ [ 7 ! XPathNavigator
? *
2 04 2
:CreateNavigator
$
7 (,8 ! XPathNavigator
T %84 A=[ CreateNavigator
.$XML
1 . Document
T2 U2 1
(,8 C +
/0. *XmlDataDocument XmlDocument
+ ! 7 ! %8 (4
=J *+= !4 *
XPathNavigator
? 1@
XPathNavigator @ A
XML 7 *
' ! W
8
XPathNavigator
?
. %8 (4 * ($
2
*&+
9
.$ XML 7
? 1@ 3
$ MoveToxxxxxx
MoveToFirst ,MoveToRoot ,MoveToAttribute, :; < 7
moveToParent,MoveToFirstChild..
+ # ! 1
XPathNavigator
T A=4 Clone
.7 XPathNavigator !$
T C 1 I0
XmlTextWriter @ A
4 A
2 A=4 ,8
%
XML 7 A=- XmlDocument
? 8
.G,
% + @
!.
7
+ ,,
B
> , %8 XML 7 A=- R 2 XmlWriter
?, +
.
? 0. !
8
P
(4 B$ 5
=G
(,8 9, (4
= I0 TextWriter
T 4
+ XmlTextWriter
? 0G
. %
XML 7 I$ I0 Stream
T 2 9, 0.
5$ XML 8 A=- + !
W 8
? 0. •
.%
= %
Stream
T 2
(,8 9, (4 P
C
7 B
2
T K$ %
T2 !
P
%G+ XmlTextWriter
? 2 + •
Stream
T 2 TextWriter
T 2
(,8 9, (4 B$ C
XmlTextWriter
. + 8 <8 H XML W7 %A @ (4 $> ! P$
*+ %A
@ (4
.8 @ 8 K$ ! 5&$ !
T> /0. .2
+
.7 A
%A
@ %$ %8 (4 * + * 7
XmlReader @ A 449 :
XMLValidatingReader @
A
. XmlValidatingReader
? . XmlReader 9 (,8 !
H
T 3.
2 *+ <
7 + XmlTextReader
?+
? 0. (4
X +
.
Stream
T 2
XmlReadr
T XmlValidatingReader
T A=4 +
. $ XML I$ 9
$ ,, 2
:XslTransform @
A
.XML W7 1 * 5, .2 XSTL 2 XSL 7 *$ (4
$
:XslTransform @
A 449 :
:. 2
XslTrasform
9
XSL 2 7 *$ Load
2 7 I2 (4
=G
xsl:include
Xml 7 5 *$ Transform
XSLT 2 XSL %$
.V P
[
8
Load
C4 9, *$ @ 7 XmlDocument
? 2 *7 0. ! X$;
%
=G + ! 1
- GetElementByTagname
@ .
..
X4 VW
@ 7 “AutherName” .
<%@Page Language="VB" %>
<%@Import Namespace="System.XML" %>
Sub Page_Load()
Try
End Try
End Sub
</script>
</body>
:8
C4 XML 7 *$ 7 XmlDocument
T ! *7 !
. Load
. NodeType
/ I0 @
(,8 <A 7 % U %8[ 1 9
@
.%8 *+ A> $
H 1 9
@ 7
<%@Page Language="VB" %>
<%@Import Namespace="System.XML" %>
Sub Page_Load()
Try
End Try
End Sub
'iterate through all the child nodes for the current node
For Each objNode In objNodeList
'if this node has child nodes, call the same function recursively
'to display the information for it and each of its child node
If objNode.HasChildNodes Then
strNodes = strNodes & GetChildNodes(objNode.childNodes, intLevel +
1)
End If
End Function
</script>
</body>
</html>
:*7
. XPathNavigator
? 1 XmlDocument
? ! *7 !
*7 # XMLNode
?
<%@Page Language="VB" %>
<%@Import Namespace="System.Xml" %>
<%@Import Namespace="System.Xml.Xpath" %>
Sub Page_Load()
Try
End Try
End Sub
Do
'then move back to the parent node (i.e. the element itself)
objXPNav.MoveToParent()
End If
Do
'recursively call this function to display the child node fragment
strNodes = strNodes & GetXMLDocFragment(objXPNav, intLevel + 1)
Loop While objXPNav.MoveToNext()
'move back to the parent node - the node we started from when we
'moved to the first child node - could have used Push and Pop
instead
objXPNav.MoveToParent()
End If
'must repeat the process for the remaining sibling nodes (i.e.nodes
'at the same 'level' as the current node within the XML document
'so repeat while we can move to the next sibling node
Do While objXPNav.MoveToNext()
Loop
End Function
</script>
<!-----------------------------------------------------------------
---------->
</body>
</html>
XmlTextReader
? %
/0. ,7d C= *
<%@Page Language="VB" %>
<%@Import Namespace="System.XML" %>
Sub Page_Load()
Try
End Try
'now ready to read (or "pull") the nodes of the XML document
Dim strNodeResult As String = ""
Dim objNodeType As XmlNodeType
'select on the type of the node (these are only some of the types)
objNodeType = objXMLReader.NodeType
Case XmlNodeType.XmlDeclaration:
Case XmlNodeType.Element:
'just get the name, any value will be in next (#text) node
strNodeResult += "Element: <b>" & objXMLReader.Name & "</b><br />"
Case XmlNodeType.Text:
'just display the value, node name is "#text" in this case
strNodeResult += " - Value: <b>" & objXMLReader.Value _
& "</b><br />"
End Select
End If
End Sub
</script>
<!-----------------------------------------------------------------
---------->
</body>
</html>
:*7
X$; .C XMl 7 + XMLTextWriter
? ! *7 !
Sub Page_Load()
'create physical path for the new file (in same folder as ASPX
page)
Dim strCurrentPath As String = Request.PhysicalPath
Dim strXMLPath As String = Left(strCurrentPath,
InStrRev(strCurrentPath, "\")) & "newbooklist.xml"
Try
End Try
'now ready to write (or "push") the nodes for the new XML document
'now open the new XML file and read it into a string
Dim strXMLResult As String
Dim objSR As StreamReader = File.OpenText(strXMLPath)
strXMLResult = objSR.ReadToEnd()
objSR.Close
objSR = Nothing
End Sub
</script>
<!-----------------------------------------------------------------
---------->
</body>
</html>
:
ASP.NET ! >
:
.,
++ 8
$ $
:!"
> 1 ,
. *; !? . W+ W ! > %
+ $ 0 U > U
Windows IIS ! > 1 ; ASP.NET *=
ASP.NET 52 9
! W, 58- + 0 . W I2 4 * 5 & (,8 5$# ,T2 B
.5 & (,8 + I2 $# I2 (4 * 1 = IG ,72 ASP.NET
:
B$4 (ASP) ! 5$# G ,8 5+ <8
2 1@ (4 * , ' 2 X A=4 •
(4 * + 0 $ Windows IIS ! > W (,8 8& •
2 5,
2 5$#
4 1 > 5 (,8 X$ K$ .NET
4 ! ,8 ASP.NET ! 5$# +
* ! +$ ! 5, 1
+ 'W
= !
%
.#
.ASP.NET 1 < *, 3, (,8 +
9 %
: ( :
\ .!8^ C2 57 C,
*+ . ! , !.
<T
> I
.C,8 9
(,8
@ + 2
X
(4 *
.5 v
@ ($ 2 +0 @ 2 @
% = 2
,+ *
: 8
F *7 * (, .
H = . 5$
H
* C2 (,8 *7 9_
R
$ ! I
> + 1
(,8 $# 3, ($ 5$# 1
1 $ H
*> $ + (Anonymous) *
2 (Guest) 9 1 $ %
>
.IWAM_%machinename% !7 $ IUSER_%machinename%
1@ 1
! 5,
1
(4 <H 4 I
IIS 8 5$ /0.
I
+ 1
IIS !
(4
=
T * $ 0[ . (,8
8
(4 * ' I0 %IUSER_%machinename $ *; $
.
I
COM+ 2 COM 5+ $# C4 *
+ 04 2
Universal Knowledge Solutions s.a.l 219
.9
_
T 8 IWAN_machinename $
.aspx *= !. 5#,+ ^
3, (,8 ASP.NET ! 5#, (4 * +$
9, (4
B
2
5 5#, (4 4 .cs .vb .cx .ax
K$ pdf zip doc 5#,
*7 5#, (4 * 8@ & . ASPNET_isapi.dll
.ACL *7
Windows 5 5#, /0. $ +$ I
:
& & 5 - 9
.V
%
f *?= X K$+ !W# ( X G ,8
ASP.NET 52 9
ASP.NET ! 58- 5+ ! ,
5@
# <
+0
# 5, * I0 web.config 9, ,8 2 2
ASP #,
. (MMC ) ISM 5
- 5
.84 + !
L5 58- +L C> IIS ! > 584 ( *$ I2 (,8
(4 C,$ , IIS , 04 ASP.NET 1 > 5,8 5,
IIS *
Application %0 ' *; 3, *$ , , 58- J
+ . ASP.NET
: Configuration
*+=
Request ,
User’s IP Address or domain *
8 2 8 *.
Permitted access?
j*
Anonymous Access Enabled? j *
* 'R *.
Windows2000 ! 5$;
(,8 #,
(4 * 'R 0 W Windows 2000 X#$
. +$+ *
H
(,8 2 C#
(,8 X#$ W /0. + 2 + .
*
%0 I
. * *# A?4 8 :5449 (
" "4
.8 . IIS (4
4
,+
#= K$ .
*@ , *
3, !
(,8 , * $ ' Windows ! $ 8 K$ IIS
& 30
+
<H 64bit (,8 !
#= 2 X$; & . 4 * $2
.8 2
P$ ! 5 ! <
0.
A?4 04 :(Digest) " 0;
7 # ) 4
; :
( :
.
,+ 5, , %0
X4 I
* *#
(4 .
#=
4
(,8 B
2 5, 1 5, /0. 1
7 /
.
#= 5, /0. C 3, 1 .($ /
#= 1 )
/0. * ..J=4 ! (4 *
2 ,+ 5+
$ ! +[ 2 ($ + .NET 5
5 IE 5
&
' $ 0. 3,
(4 * , 'R 04 H !.
$ ! C
$ $ Authentication Methods %0 +
*
Universal Knowledge Solutions s.a.l 224
Universal Knowledge Solutions s.a.l 225
.Request.ClientCertificateCollection <
C# B$ (4 * +
.Users 8
(4 (4 <H 5$ 1
4 I
! TestGroup %
8
(4 4 <W, %
58
1
! *+= ! X$;
. W=[ @
$ 3, & !
(4 * I2 + . $
*+ ACL * +$ W@ ! %< 8 5$ 5, . 4 *
.
,$ 5,
5#, (,8 5$ %
4 + ;
< 7 :
% W /0. %
4 +
.+=
8
(4 * C+
(,8 * 5$ $ ! <2 IIS *
B
2 (,8 $ + /$
H $ I2 2 (IUSER) $ *
.C4 * I0
*# 2 + I0
(,8 + 5, /2 *+= !
.X Home Directory ! A
!
X
.
*?=/+/%A
@ ,
2 1@
/0.
9+ B
IIS 2 *?= X G , 5> 8
.ASP.NET ! %
> 5 1
:ASP.NET 52 8
.*7 & < + 04
! ASP.NET (> % ,
0# , + 04
0 %
1 IIS ! *7 # C= # +
+$ + . 5,, ASP.NET C $ 5$; 2 5$;
.machine.config 58- 9, <ProcessModel>
*; <, $
.“AutoGenerate”
,+ + “machine” . !W, +
ASP.NET ! ;
< # *7 + 04 €
$ , 1 * IIS ! ;
< # * + 04 o
. IUSER_%machinename% . IIS ! *
$ (,8 <8 , 1 * .8 IIS ! *#
T * + 04 o
. , *
Windows
I
K$ *@ , !
, ACL W@ $ $ ;+ ! o
.
0. 1 * ' $ + 04
(4 * \
+. 5 ! * > 5
8
ASP.NET
.,
0
,
web.config 9, 5
/0. *+
$ 1 * 1 (,8 +
30 9, 0. #+
< @
.5$
<configuration>
...
<system.web>
<authentication mode="Windows|Passport|Forms|None">
authentication options used for the application
</authentication>
<authorization>
users and roles that have access to the application
</authorization>
<identity>
if application should run under a different account
</identity>
</system.web>
...
</configuration>
4 *$ ! ($
*#> (4 (,8> <deny> <allow>
8 ,
. *2 (,8 *$,
HTTP 52
* HTTP * +$ <deny> <allow>
8 <2 +
:! *7 ! + Verb #
<configuration>
...
<system.web>
<authorization>
<allow verb="GET" users="*" />
<allow verb="POST" users="MyDomainName\marthasmith" />
<deny verb="POST" users="*" />
</authorization>
</system.web>
...
</configuration>
Windows "4
( : IIS Windows ;
+ ASP.Net * %
Windows 5$ (,8 “Windows” * 2
+0
.
(4 *,
5$ $ 0. A8[
(4 *, C 5$ I2 ! *+= '
:
*+=
Anonymous Access Enabled in *
* 'R *. !
IIS?
IISj
Using <identity <identity
impersonate=”True”/>?
impersonate=”True”/>
Specifying an account within the $ $ <identity>
<identity> section to run under
C *,
Universal Knowledge Solutions s.a.l 236
Set permissions for the specified $ $, 5$
account
Set permissions for ASPNET A
- $ 5$
process account
ASPNET
Set permissions for individual I2 %
# 5$, 5$
user accounts , that is accounts
included in <authorization> ! 5$
section <allow> element <authorization>
<allow>
To grant access to anonymous
T) *
* \,
users (not required in a secured
application) include ‘?’ in
(H ! ,
permission for IUSER (IIS) $ 5$ ! "j"
account
IIS ( IUSER
The common scenario <8=
7+> $
Yes
No ;+
Passport (4 5, *
[
/0. 8 1@ (,8 * *
8
.
(,8 ++ 1 $ !
(4 ++
X[
/0. 8
H 1@ (4 * *$ 8
.C. $ @ C2 <7 Passport
! $#, ! $ $ redirectURL !. %$ # <passport>
8
(4 Passport 57 *@ <W, /0. + . $ *= *$ ! 4 C
.“Internal”
>? 0 5
( :
.P0
8 $ A
4 \
= ! *+= \
=
0. 2 / %
T ++ 5+ 04 2 . (4 * , 04 ++
C
& ! 5 ++ $; 2 2 < (4 * *
*
[
,+ * 5, * . * *
P0 (4
(4 , *
4 ,
(4 4 ++ A=4 $ K$ (4 5,
. ,
(4 * $ +G K$ ,$
>? 0 5
( : ;
>? 0 5
( : ;
:P0 (,8 ! $ $ ! web.config 9, C,8 (,8 *7
<configuration>
...
<system.web>
<authentication mode="Forms">
<forms name="MyNewApp" path="/" loginUrl="/main/login.aspx"
protection="All" timeout="30" >
!,+ + !
:" )4 5)
!
& 04 <H A!= *+ 1 + +0 P0 (,8 ! $ + T
. , 5, A> !
+
:!
(4 ! [
/0. + <04
>? 0 5
( : ;
timeout # @ *; , 04 @ 30 ++ $; W, % +
. web.config 9, ! <forms>
*+ 1 ++ K$ 9 1 .
;T4 8 <2 ++ $; A 4
. $# (4 *
H $ 30 . $ -
:SignOut
<
@ ++
1 *$ I2 (,8
FormsAuthentication.SignOut()
>? 0 5
Z 4 ;
' !
!. $ + P0 (,8 ! $ 8 ] ($ ,+
&4 web.config 9, (4 <authorization> 4 + . 4 * ,
C I$ I0 machine.config 9, ! %$ W, 5$
:!, <authorization>
<authorization>
<allow users="*" />
</authorization>
"
2 (,8 8&
(4 * +$ (,8 +
] ($ C,8 , *; X$&
, 5$ +G 7 $ (,8
%
9
. %$
*; * C \
$ (4 P$ ! 5&$ 3. +
!, .IPrincipal , User
T> 8
5, 3, A2 .!
. 1 ! 5,
7 <
4
:
.W 5#, asp.net ! 5
:
Glossary 6
X2
:!"
5#, 584 !
7+2 5H 5@ +
7+ C 5 # ASP.NET 5
.W
%#& #+ W 5#, .A=4 #+ 5 # (,8 9
,
/0.
: # $%&
+$
8 5 ASP.NET 5$#+ B
2
52 # 0. 1 Asp.net 5@
*@ 4 .J=4 %8 B
2 5#, global.asax 9, 5 84 9,
.ASP.Net ! 2
5#, global.asax 9, .A=4 #+ 5 # (,8 9
,
/0.
. %#& #+ machine.config web.config
!
,
A=4 +[ 9+ 2
.W
+0
& 5,
5,
!
8
. IIS !
j (4 ,
0. *$ 9+ !
,
2
# ]
X .8 Properties
!
& ,
(,8 >
2 +
: (4 *+= ! + ==
*+ . 5, 5@ 9
IIS 5 ASP.NET
5 3
= I2 .B
> 5@ 1 %
+0 3
= & H B
> 5@ 8 *#
. 5@ 1 (<$& # 8 ,+ 5 !. ) Application Session *7
8 *#
7J
T ! 5 $2 *8 ! *, I2 *
/0. *# ,8
.5
(4 4 .J=4 , + !
2 7;7 %8 ASP.NET 5 9G
: 5 5$# ASP.NET ! 3,
!
5, A$&
0
,
%
= 1 ,
0. BIN
.5
' . ASP 1 < + I0 global.asa 9,, * . 9, 0. Global.asax
B (,8 30 5
? (4 @ 4 ASP.NET ! K$d !
0#
.;
< +
+ . , > B (,8 <8 *+ 584 A84 m+ :Web.config
I0 machine.config 9, ! 58- (,8 ? 9, 0. ! 7 58N
. (,8 7 ASP.NET W ! 5 1
(,8 ! 58- $
: )4
A
+ 5+ *
Bin . ,
ASP.NET X 5;
(,8 8& 8 <8
.
+ *7 * (,8 X
8 5+ *
(ASP !) < , /0. 5+
COM+
8 2 5+ *
REGSVR32.EXE %> &
.+$ $
- 5>
! Component Service
<%
Dim myObject
Set myObject = Server.CreateObject("Example.DataAccess")
%>
* K$ 5,8 +- '2 ASP.NET ! *+= 3, *+ *$ L
.W /0. +
7+2
+ f !#+ *+ .5+ *
(4 !,$ * .NET , & L
*@ ; %
' ASP.NET *@ $= K$ Bin ,
(4 1
?,
.
&4 ! ,
5+ ! *+ Bin $ ,
B
& L
. 0
* + *+ (ASP +) IIS 94 (4 ASP.NET ! + I2 *& P$ & L
. (,8 * 2 +
!
9, (,8
2 Bin ,
(,8 5; 2 (,8 5 > /0. ASP.NET ' L
(4 2 C,8 5, !, 2
A=[ <
* I2 9=+
.30 C4 $ 5, 1 * /A 4 $
X& * *@
global.asax $ : 4
: ? %8 0G ASP.NET 5$# C= global.asax 9, 1
<%@ [Directive] [attribute]=[value] %>
<Script runat="server">
[Application Event Prototypes]
</Script>
:()
0.
! 5, (4 4 ASP.NET 5$# 5, global.asax 8
: global.asax 8 ! 5
.2 . 9,
global.asax $ : 4
:5)
! [
%
=G %+ global.asax ! !
8 '
<Script runat=’server’>
8 9, (4
virtual I 5#, X (,8 <8 9, (4
file *7 K$
.
.global.asax 9, (4 C
*@ 9, B$ 4
Session *8 *
T2 8 '
, <object> %
=G + 30+
%$ COM
T2 2
.NET 5#, A=- %
=G /0. + . Application
.CLSID 2 ProgID
:!. 5# K;7 #
+ .J=4 + !
T> U2
.<object> %
=G 5# /0. $2 + K$ classid progid Class
<object id="appData" runat="server"
class="System.Data.DataSet" scope="Application"/>
9 ;
< 7 *+= I0 “appData”, & *$ 9
@ 2 ! *7 ! B
.System.Data.DataSet
+ *. *$ %$ $ ! *$ 0. * 9 *
! Scope # $
. “Session”
*$ ! $ ,
2 “Application”
*$ !
:5)
! [
%
=G %+ global.asax ! !
8 '
<Script runat=’server’>
ASP.NET 52 C (
C:\WinNT\Microsoft.NET\Framework\v.1.00\config\machine.config
0
1@, 9, 0.
wwwroot:9, ! %
5,
C:\inetpub\wwwroot\web.config
:9, .
+ !
D:\MyApplication\web.config
XML 5#, 5+ A$ C+ XML 9, . web.config 9, [
+0 +
. 5 5
=G
.<W, 30 X 9=+ K$ Unicode 2 Utf-8 2ANSI 9,
+ 2 +
*+= 9, 0. B$ 0G K$ <configuration> %
=G . Web.config 9,
0
<configuration>
<!- Configuration settings would go here. -->
</configuration>
.
U2 K;7 (,8 <configuration> %
=G I$
W @2 5
8 5$
•
W @2 58
•
W @2 584 •
: C ( 4=& )#
58- 2 9, , web.config 9, 5
I2 ASP.NET 1 &
@2 5
(4 web.config 9, 5
*+ 30 8 <8 .C 8
! .NET *8
4 9# !. W
. IConfigurationSectionHandler
7
K$ machine.config !> 9, *@> (,8 9 0. 8 '
&
.8
# 5,
1
! 9 0. 8
+ <configSection> %
=G web.config 9, 5
/0. 8 '
. @> 58
58
@> 2
9 8 *7 (4 4 W 5, I$ web.config 9, ! @ *+
.C
IConfigurationSectionHandler
: C ( 4=& )
%
=G
X 2 + . X
T> @d
. 1
+4 ASP.NET
.B
2<sectionGroup> %
=G 2 <configSections> %
=G <SectionGroup>
. <system.web> @> 8
@> 5
1
X *7 * (,8
Universal Knowledge Solutions s.a.l 256
: C ( 4=&
. @> 5
=G W 58- 1
$ <httpModules> %
=G *7 * (,8 . @ *+ 9
@ V
&
9 ( . HTTP* 5$ 58-
B$
# ,8 System.Configuration.HttpModulesConfigurationHandler
. <httpModules> %
=G
. 8
# # V + 2
C2 . X$;
.(%
? %
+) 9
$> $ 5
=G, A> G /& & 30+
:8
<configuration>
<configSections>
<sectionGroup name="system.web">
<section
name="httpModules"
type="System.Web.Configuration.HttpModulesConfigurationHandler,System.Web"
/>
</sectionGroup>
</configSections>
<system.web>
<httpModules>
<add
name="CookielessSession"
type="System.Web.SessionState.CookielessSessionModule,System.Web"
/>
<add
name="OutputCache"
type="System.Web.Caching.OutputCacheModule,System.Web"
/>
<add
name="Session"
type="System.Web.SessionState.SessionStateModule,System.Web"
/>
<add
name="WindowsAuthentication"
type="System.Web.Security.WindowsAuthenticationModule,System.Web"
/>
<add
name="FormsAuthentication"
type="System.Web.Security.FormsAuthenticationModule,System.Web"
/>
<add
Universal Knowledge Solutions s.a.l 257
name="PassportAuthentication"
type="System.Web.Security.PassportAuthenticationModule,System.Web"
/>
<add
name="UrlAuthorization"
type="System.Web.Security.UrlAuthorizationModule,System.Web"
/>
<add
name="FileAuthorization"
type="System.Web.Security.FileAuthorizationModule,System.Web"
/>
</httpModules>
</system.web>
</configuration>
: C ( 4=& )
%
=G
X 2 + . X
T> @d
. 1
+4 ASP.NET
.B
2<sectionGroup> %
=G 2 <configSections> %
=G <SectionGroup>
. <system.web> @> 8
@> 5
1
X *7 * (,8
: C ( 4=&
. @> 5
=G W 58- 1
$ <httpModules> %
=G *7 * (,8 . @ *+ 9
@ V
&
9 ( . HTTP* 5$ 58-
B$
# ,8 System.Configuration.HttpModulesConfigurationHandler
. <httpModules> %
=G
. 8
# # V + 2
C2 . X$;
. 9
$> $ 5
=G, A> G /& & 30+
<location path="EnglishPages">
<system.web>
<globalization
requestEncoding="iso-8859-1"
responseEncoding="iso-8859-1"
/>
</system.web>
</location>
<location path="EnglishPages/OneJapanesePage.aspx">
<system.web>
<globalization
requestEncoding="Shift-JIS"
responseEncoding="Shift-JIS"
/>
</system.web>
</location>
</configuration>
: C ( ; =;
2 584 $ + <location> %
=G 584 $ (4 -
.
H 9, W 584 9, 0. ! %$ W 584 /0.
? & K$
(4 %$ 1@ (,8 allowOverride # + 584 8
*#@-
.false
.#, *7 584 *#@[ W ! *7 !
<configuration>
<system.web>
<identity userName="developer" password="loginpw" />
</system.web>
</configuration>
.G
X 9
1
C
I0 ,
(4 W 58- 1
K
!W, *+=
+0 +
.C 8
# 5,
%
=G !$ W 9, !8
584 +
. path # 1 <location>
5,
584 + machine.config . !$ W 9, + *$ !
9, 58- 3+ web.config 5#, ! .5 2
&
. 2 !
,
,
: C ( ; =;
2 584 $ + <location> %
=G 584 $ (4 -
.
H 9, W 584 9, 0. ! %$ W 584 /0.
? & K$
(4 %$ 1@ (,8 allowOverride # + 584 8
*#@-
.false
C ( # ) 4
(4 %
= * W 584 (4 *
, Asp.NET '
. (API)
5; 2 8-
Browser <browserCap> W @ (4 * $# ! *7
. System.Web.HttpRequest 9,
<html>
<body style="font: 10pt verdana">
</body>
</html>
W 584 (4 *
1
/0 * +4 (4 -
.W ! @ I2 5 % System.ConfigurationSetting 9
V (,8 ConfigurationSettings C84 I0
? 2 . X$;
. 0
. <customConfig> , W 5 (4 * #+ ' ! *7
1 CustomConfigSettings
T 9 V 2 7
#
Enabled
:
; "4
*75, 58- X#$ . W 5#, .2
7+> 5& $2 + @
5 %8 *& 5, 9
9
$ ,, 58-
.f4... XML 5#, 1@ 5#, 5
I0 <appSetting> (machine.config 9, %$) <W,
@>
. (@/) 5W7 *+= (,8 58- C +
. 5 %8 * 9
I0 <appSettings> ! *7
X
Universal Knowledge Solutions s.a.l 262
<configuration>
<appSettings>
<add key="pubs" value="server=(local)\NetSDK;database=pubs;Trusted_Connection=yes" />
<add key="northwind"
value="server=(local)\NetSDK;database=northwind;Trusted_Connection=yes" />
</appSettings>
</configuration>
.W 584 9, ! X#$ C %#& ! $#, !
!,
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Configuration" %>
<html>
</script>
<body>
</body>
</html>
________________________________________________________________________________
9 F*) –
7 8
:
ASP.NET ! A
:
5 A !W
A P
A $; A A
:!"
/0. ASP.NET 5# .A> 1
5&
7+ ! ,
5] A
. &
8
5@
. #+
/0. (,8 9
,
/0. *; *$
: # $%&
:(,8 *# 0. ! 9
MC@
A # •
P
A •
!W
A •
5 A •
:"
ASP.NET ! A
, ;
< 7 $#
$ –<,8 $# *+ A +& $> !
#,+ P$ ! 5 2
T> (,8 $# ! 9
I
+ $ /0. ! . , *+
+ + . %$ % W .J=4 + .8 . W $ W=- 8 (
)
.$# P
1 Z !W
Z
F 2
:F" *
. .> ? 5
$2 <2 A $
.$ 5@ 5 $; $ 2 X *# 5 K$ 2 +
A *$ ! A
4 $ $; A
A84 $ /0. !
.C$;
! A 8ASP.NET
8 A=4
m+ *+= A \# 2 9, U 5$,
8 $; A - /0. K$
H A
8 (,8 2 !
9, (,8 A
.(
H
8 2 9,)
!
? I2 (,8 <8
I0 B$, A A
[
/ , ,,
& % ! # 5 $2 P
A
.+ 5$# /
, I>
I2 A <,8 + Asp.NET ! <W, *_ #R P
A
+
.A , ,@
& *
' A
4 0
(,8 (4
@ (4 4 A $; +; & A , ,@
*
.A (4 *
A ! $# + 0[ . $# $ A & 5
+0 + P
A 1
@ 60 A $# 4 A @ 60 A & $ P
.P
A
C
P
A
! *7 '@OutPutCache
X K$
.C
& I0
C
, X$;@outPutCache # @ $ (4 4 7 60 * A %
VaryByParam (4 “non” + A
$ 9, $# 2 (
GET 2 POST.
</script>
<body>
</body>
</html>
] , A , HTTP 5
(,8
+2 %
! 5, 2
. System.Web.HttpCachePolicy 9 . !
Response.Cache.SetExpires(DateTime.Now.AddSeconds(60))
Response.Cache.SetCacheability(HttpCacheability.Public)
.
%8[ <nW
(4 C
, A & 8
$; ! 0[
$ !, A
! 5&$ ! A & #
.
, 8 A?& + 5$
:!. ASP ! 5+ ! (,8 ASP.NET X$ 30+
Response.CacheControl = "Public"
Response.Expires = 60
: 8
. !$
X- Timemsg +$
8 X$; ! *7 !
C> A * $# 5+ 04 0. +$
# !
0.
X
.B
2 %
$# 0# %84
<html>
<script language="VB" runat="server">
queryState = Request.QueryString("state")
If queryState = Nothing
selectCmd = "select * from Authors"
Else
selectCmd = "select * from Authors where state = '" + queryState + "'"
End If
MyConnection = New
SqlConnection("server=(local)\NetSDK;database=pubs;Trusted_Connection=yes")
MyCommand = New SqlDataAdapter(selectCmd, MyConnection)
Universal Knowledge Solutions s.a.l 268
ds = New DataSet()
MyCommand.Fill(ds, "Authors")
MyDataGrid.DataSource=new DataView(ds.Tables(0))
MyDataGrid.DataBind()
</script>
<body>
<h3><font face="Verdana">Using the Output Cache</font></h3>
<b>Authors by State:</b>
<p>
<p>
5C*) F"
6 6 A
2 P
A
ASP.NET ,+ $# P
A (4 -
.!W
A , /0. ( . $# 5$
6 C6,8 A 6 *# +$
W
A
> $ ,
. (,8 A
> /0. A !7 $ K$ @OutputCache C
<8 A fQ 7 120 % P
A Asp.NET (4 !
8 *7 * (,
SelectedID CategoryID @ (,8
6 > SelectedID 2 categoryID 6 @ *+ $# A=4 A fQ .
6$ !6 C64 *6 I0 A 2 I2 .5, 1
$$ + A !
:9, ,
http://localhost/mypage.aspx?categoryid=foo&selectedid=0
http://localhost/mypage.aspx?categoryid=foo&selectedid=1
#6
6 86
6 C6
6[ VaryByParam #6
6, outPutCache C6
6
6
68 (6
64 6
6-
.VaryByControl
+$
8 +$
8 9; (,8 <8 VaryByControl ! A fQ
! (@/) 5W7 (,8 <8 VaryByParam $ ! A f $ !
:Post 2 GET
4
*6# T
8 *$ ! ($ $
%
VaryByParam # & :X$;
.5; @ (,8 A A fQ
Universal Knowledge Solutions s.a.l 270
5C*) F"
+$
A
W@ +$
8 +$
8 B$ 04
.0. W +$
8 %
(,8 A
.W
A 58
+ A
2 A + +
P0 % 0.
. +$ 8 W@ @ A 9+ ! *7 '
<html>
<body>
<table>
<tr>
<td>
<Acme:Menu Category="LeftMenu" runat=server/>
</td>
<td>
<h1>Hi, the time is now: <%=Now%> </h1>
</td>
<td>
<Acme:Menu Category="RightMenu" runat=server/>
</td>
<tr>
</table>
</body>
</html>
F"
A=4 %84 *?= %84 %$ % , A %
+0 %$ % + •
.
A %
+0
F"
:8
5 %8@ (,8 ; 0# K$ A &
! *7
X
. %$ %
*; !
A
@
2
X $#, , *2 8 .$# *#2 !
X$; *7 0. *?= 8
A 5, .
G *
X4 . 5 ,8 *$&
<html>
<script language="VB" runat="server">
Source = Cache("MyDataSet")
If Source Is Nothing
MyConnection = New
SqlConnection("server=(local)\NetSDK;database=pubs;Trusted_Connection=yes")
MyCommand = New SqlDataAdapter("select * from Authors", MyConnection)
MyDataGrid.DataSource=Source
MyDataGrid.DataBind()
End Sub
</script>
<body>
</form>
</body>
</html>
:2 *7
.XML 9, (,8
8
X4 *7 0. !
(4
*
4 8 XML 9, . . 5,
+ *7, = %
+#
.A !
A=4 %84 $# P0 9,
<html>
Cache.Remove("MyData")
LoadData()
End If
End Sub
Sub LoadData
Dim Source As DataView
Source = Cache("MyData")
If Source Is Nothing
Dim ds As DataSet
Dim fs As FileStream
Dim reader As StreamReader
MyDataGrid.DataSource = Source
MyDataGrid.DataBind()
End Sub
</script>
<body>
<form runat="server">
<hr>
<asp:Label ID="AuthorMsg" Text="Fill in the required fields below to add a new author"
ForeColor="red" Font-Name="Verdana" Font-Size="10" runat=server />
<p>
<table>
<tr>
<td>Author Id:</td>
<td><ASP:TextBox id=AuthorId Text="111-11-1111" runat=server/></td>
<td><ASP:RequiredFieldValidator ControlToValidate="AuthorId" Display="Static"
ErrorMessage="*" runat=server/></td>
</tr>
Universal Knowledge Solutions s.a.l 276
<tr>
<td>Last Name:</td>
<td><ASP:TextBox id=LastName Text="Doe" runat=server/></td>
<td><ASP:RequiredFieldValidator ControlToValidate="LastName" Display="Static"
ErrorMessage="*" runat=server/></td>
</tr>
<tr>
<td>First Name:</td>
<td><ASP:TextBox id=FirstName Text="John" runat=server/></td>
<td><ASP:RequiredFieldValidator ControlToValidate="FirstName" Display="Static"
ErrorMessage="*" runat=server/></td>
</tr>
<tr>
<td>Phone:</td>
<td><ASP:TextBox id=Phone Text="555 555-5050" runat=server/></td>
<td><ASP:RequiredFieldValidator ControlToValidate="Phone" Display="Static"
ErrorMessage="*" runat=server/></td>
</tr>
<tr>
<td>Address:</td>
<td><ASP:TextBox id=Address Text="One Microsoft Way" runat=server/></td>
<td><ASP:RequiredFieldValidator ControlToValidate="Address" ErrorMessage="*"
Display="Static" runat=server/></td>
</tr>
<tr>
<td>City:</td>
<td><ASP:TextBox id=City Text="Redmond" runat=server/></td>
<td><ASP:RequiredFieldValidator ControlToValidate="City" ErrorMessage="*"
Display="Static" runat=server/></td>
</tr>
<tr>
<td>State:</td>
<td><ASP:TextBox id=AddressState Text="WA" runat=server/></td>
<td><ASP:RequiredFieldValidator ControlToValidate="AddressState" ErrorMessage="*"
Display="Static" runat=server/></td>
</tr>
<tr>
<td>Postal Code:</td>
<td><ASP:TextBox id=PostalCode Text="98052" runat=server/></td>
<td><ASP:RequiredFieldValidator ControlToValidate="PostalCode" ErrorMessage="*"
Display="Static" runat=server/></td>
</tr>
<tr>
<td>Contract:</td>
<td><ASP:CheckBox id=Contract Checked runat="server"/></td>
<td></td>
</tr>
</table>
<hr>
<p>
</form>
</body>
</html>
58 F*)
:
*8 =
:
*$& ,R K$> *$ K$ +2 K$ K$ A
:!"
+
1 !
+
*+ *$
,
A
0.
?
., !
+ , !$ (,8
: # $%&
:(,8 *# 0. ! 9
! *8
4 5,
*; ? 5 ! ,
V #+ •
7
Getproducts = products.Tables(0)
End Function
GetProduct = product.Tables(0).Rows(0)
End Function
GetProductCalories = details.Tables(0)
End Function
End Class
public Sub New(ProductID As Integer, Name As String, Price As Double, Quantity As Integer)
MyBase.New
me.m_ProductID = ProductID
me.m_Quantity = Quantity
me.m_Name = Name
me.m_Price = Price
End Sub
Set
m_Quantity = Value
End Set
End Property
End Class
Get
If (m_Orders.Count = 0) then
SubTotal = 0.0
End If
Dim x as OrderItem
For Each x in m_Orders.Values
SubTotal += x.Price * x.Quantity
Next x
End Get
End Property
Set
m_TaxRate = TaxRate
End Set
Universal Knowledge Solutions s.a.l 281
End Property
End Class
End Namespace
If Microsoft.VisualBasic.IsNothing(Session("ShoppingCart")) Then
Session("ShoppingCart") = new Market.OrderList()
End If
End Sub
</script>
.(%$ (,8 A
*+ *# . + $ aspx 9, *+= ) aspx + 2 7
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="Market" %>
<html>
<head>
<title>GrocerToGo</title>
<link rel="stylesheet"href="grocerstyle.css">
<style>
div.details { background-color:ffffcc; padding-top:15; padding-bottom:20; }
div.details table { width:375; }
div.details table td { font-family:Verdana; font-size:8pt; }
</style>
ProductListing.SelectedIndex = 0
UpdateProducts()
UpdateShoppingCart()
End If
End Sub
UpdateShoppingCart()
End Sub
' Iterate over items in shopping cart (update cart with current row qty textbox value
Dim i As Integer
Dim qty As HtmlInputText
for i = 0 To ShoppingCartList.Items.Count - 1
Universal Knowledge Solutions s.a.l 284
qty = Ctype(ShoppingCartList.Items(i).FindControl("Qty"), HtmlInputText)
Try
shoppingCart(CStr(ShoppingCartList.DataKeys(i))).Quantity = CInt(qty.Value)
Catch exc As Exception
End Try
Next i
UpdateShoppingCart()
End Sub
shoppingCart.ClearCart()
UpdateShoppingCart()
End Sub
:5
W@ K$
+0 + <
1, !
!,
Sub UpdateProducts()
Name.Text = product("ProductName").ToString()
SelectedProdPicture.Src = product("ImagePath").ToString()
ServingSize.Text = product("ServingSize").ToString()
Servings.Text = product("Servings").ToString()
DetailsListing.DataSource = market.GetProductCalories(productID).DefaultView
DetailsListing.DataBind()
End Sub
Sub UpdateShoppingCart()
ShoppingCartList.DataSource = shoppingCart.Values
ShoppingCartList.DataBind()
End Sub
</script>
<form runat="server">
</td>
</tr>
</table>
<p>
<h3>
<b>Product Category: <asp:label id="CurrentCategory"
runat=server>Milk</asp:label><b>
</h3>
<div class="details">
<ItemTemplate>
<table cellpadding=0>
<tr>
<td colspan=3>
<b><%# DataBinder.Eval(Container.DataItem, "Name") %></b>
<%# DataBinder.Eval(Container.DataItem, "Grams") %>
</td>
<td align=right>
<b><%# DataBinder.Eval(Container.DataItem, "Percent") %>%</b>
</td>
</tr>
</table>
</ItemTemplate>
<SeparatorTemplate>
<table cellpadding=0 >
<tr>
<td colspan=4 height=1 bgcolor="000000"></td>
</tr>
</table>
</SeparatorTemplate>
<FooterTemplate>
<table cellpadding=0 >
<tr>
<td colspan=4 height=5 bgcolor="000000"></td>
</tr>
</table>
</FooterTemplate>
</asp:repeater>
</div>
</td>
</tr>
</table>
<p>
<table>
<tr>
<td class="products">
<ItemTemplate>
<table>
<tr>
<td width="150">
<p>
<SelectedItemTemplate>
<table>
<tr>
<td width="150">
<p>
</asp:datalist>
</td>
</tr>
</table>
</td>
<HeaderTemplate>
<table width="100%">
<tr>
<td width=35>
<b>Qty</b>
</td>
<td width=175>
<b>Product</b>
</td>
<td width=50>
<b>Price</b>
</td>
<td align="right" style="padding-right:10">
<b>Total</b>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td width=35>
<input type=text size=1 id="Qty" runat=server value='<%#
DataBinder.Eval(Container.DataItem, "Quantity") %>'>
</td>
<td width=175>
<%# DataBinder.Eval(Container.DataItem, "Name") %>
</td>
<td width=50>
<%# DataBinder.Eval(Container.DataItem, "Price", "{0:C}") %>
</td>
<td align=right style="padding-right:10">
<%# DataBinder.Eval(Container.DataItem, "Total", "{0:C}") %>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
Universal Knowledge Solutions s.a.l 290
</asp:datalist>
<p>
</td>
</tr>
Universal Knowledge Solutions s.a.l 291
</table>
</form>
</body>
</html>