|
|
 |

 |
|
Microsoft® ASP.NET Web Matrix Starter Kit
|
|
|
Author
|
|
Mike Pope
|
|
|
Pages
|
400
|
|
Disk
|
1 Companion CD(s)
|
|
Level
|
Beg/Int
|
|
Published
|
01/22/2003
|
|
ISBN
|
9780735618565
|
|
Price
|
$29.99
To see this book's discounted price, select a reseller below.
|
|
|
|
|
 |
|
|
Index
Symbols and Numbers
& (ampersands) in URLs, 215
* (asterisks), regular expressions and pattern matching, 175
\ (backslash characters), MapPath methods and, 108
<> (brackets), converting to HTML, 168
| (pipe character)
converting to different character, 111-12
in text files, 104-5
? (question marks)
regular expressions and pattern matching, 175
in URLs, 215
" (quotes), default column type set to, 150, 152
<%# and %> tags, data-binding expressions in, 200
A
absolute paths, 70
absolute positioning, 51-53
Access, support for, 140-41
Add New File dialog box, 44-45
AddSlides.aspx
creating and formatting, 241-55
orphaned slides, 256
ADO.NET objects, 141-45. See also specific objects
All view, 51
ampersands (&) in URLs, 215
angle brackets (<>), converting to HTML, 168
anonymous users and security, 310-12
Application objects
caching quotations using, 114-16
Session objects compared to, 218
appointments. See calendar applications
appSettings> settings of Web.config files, 319
arguments in event handlers, 59
ArrayList objects, 107-8
arrays. See also specific arrays
collections compared to, 89
index values of elements in, 76
returned by Split method, 112
Session objects compared to, 219
slide arrays, 69-70
storing caption text using, 80-82
storing random quotes text using, 107-8
arrows, four-way, 52
ASCII text files. See text files
<asp:> prefix, 62
ASP.NET
colors supported by, 90
databases supported by, 140-41
hosts support for, 31-33
installing and configuring software required for, 33-39
ISP support for, 30
in .NET Framework, 16
overview, 15-17
programmed pages processed by, 6-7
Web site for, 19
ASPNET account
configuring access when hosting sites yourself, 324-25
security and, 310-12, 318
SMTP virtual server configurations, 284
ASP.NET events. See events
ASP.NET pages. See pages
"ASP.NET Security Issues," 309
.aspx files. See also specific filenames
editing connection strings in, 334
servers handling, 6-7, 312
asterisks (*), regular expressions and pattern matching, 175
Attachments collection, 299-300
authentication, 232, 315-17. See also passwords
AutoPostBack property
of DropdownList control, 101
of ListBox control, 214
B
backslash characters (\), MapPath methods and, 108
Baseline Security Analyzer, 309
BeforeUpdate event, 253
binary data, storing in databases, 208-9
binding data. See data binding
blank lines in text files, 105
BMP files, hit counters using, 132
BodyFormat property in guestbook alert pages, 293
Boolean (bit) columns in tables, default values for, 152
<br> tags, creating, 164
brackets (<>), converting to HTML, 168
browser-based programming, 10-12
browsers
cookies sent to, 126-27, 128, 216
support for absolute positioning, 52
support for programming, 12
builders. See code builders
Building a Community Information Network: A Guidebook, 31
bulleted lists, creating, 202-3
Button controls
adding to pages, 49
programming, 57
setting properties for, 55-56
buttons
colors of, 55-57, 68, 92-93
New Message button, 290
Next and Previous buttons, 74-77, 227-28
Preview buttons, 91-95
Save Preferences button event handler, 96-97
Send This Picture button, 295-96
for sending e-mail, 288-91
for signing guestbooks, 292-94
Text property of, 55, 79
for updating databases, 252, 253-55
C
C languages, using with Web Matrix, 21
cache. See also storage and storing data
caching data during round trips, 145-46
caching data in Session objects, 218
caching quotations in Application objects, 114-16
deciding where to cache files, 114-16
overview, 114
storing customized information in Session objects, 218
calendar applications
adding controls, 262-63
adding new appointments, 265-67
creating database table for, 260-61
creating drop-down lists, 263-64
creating pages
for adding appointments, 261-67
for viewing appointment details, 272-76
for viewing appointments, 268-72
formatting elements, 262
programming date selection, 264-65
reminder feature, 267
Calendar control
changing appearance of, 261-62
creating pages
for adding appointments, 261-67
for viewing appointment details, 272-76
for viewing appointments, 269-72
overview, 259
programming date selection using, 264-65
CalendarEntry.aspx, 261-63
caption labels showing previews of user preferences, 91-95
captions, adding to slideshows, 80-82
cascading deletes (MSDE), 256
Catch blocks. See Try-Catch blocks
CD with this book, 36-38, 66
cdosys.dll, 282-84
Cells collection, updating databases, 254
certificates and SSL, 316
Char and VarChar data types, 151-52
character columns, defining, 151
characters in strings. See also specific characters
converting to HTML, 168, 237, 312-13
delimiters, 104-5, 112
extracting, 135, 175
wildcard characters and pattern matching, 175
check box controls, 87
"Checklist: Install a Firewall," 307
"Choosing between NTFS, FAT, and FAT32," 308
classes of objects, 23-24
Classes tab (Properties window), overview, 47
Click event handlers
adding
calendar records, 266-67
slides to databases, 244-45
slideshow records, 236-37
displaying slides, 247-48
e-mailing page contents, 295-96
e-mailing pictures from pages, 299-300
guestbooks, 167-70, 292-94
Next and Previous buttons, 74-77, 228
overview, 59
Preview buttons, 91-95
running slideshows, 216
sending e-mail messages, 288-91
validation testing and, 180
Click events, 59, 60
client-based programming, 10-12
closing files, after reading them, hit counters and, 128
closing objects, importance of, 109
code, repetition in, 82-83
code builders
for connection strings, 187
Query Builder dialog box, 165-66, 223
for sending e-mail messages, 288
WHERE Clause Builder dialog box, 223-24
Code view. See also hard-coding
adding captions to slideshows, 81-82
switching to, 51
coding style used in this book, 21-22
collections, 89. See also specific collections
Color objects, namespace for, 92
colors
available choices, 90
of buttons, 55-57, 68
setting
calendar elements, 262
data-display grids, 156
properties for, 55
slideshow pages, 68
user preferences for
adding drop-down lists to pages, 88-90
cookies and, 95-96, 97
programming Preview button, 92-93
columns in tables
binding controls to, 184, 191-94
for calendar applications, 260
default column type, 150
defining, 151-52
command objects, 143-44
CommandText property of command objects, 143
Comments fields in guestbooks, validating, 179-81
community support for Web Matrix, 19, 47-48
Community window, 47, 48
companion CD, 36-38, 66
CompareValidator control, 174
components of .NET Framework, 17-18. See also specific components
computer icon with green arrow, 147
computer IDs and computer names, locating, 324-25
conditions, 26-27. See also specific conditions
connection objects
overview, 142-43
SqlDataSourceControl and, 154, 156-57
Connection property of command objects, 143
connection strings
builders for, 187
editing when moving data tables to hosts, 333-34
security and, 314, 318-20
ConnectionString attribute of SqlDataSourceControl, 156-57, 187-88
constraints (MSDE), 256
containers
for data (datasets), 217-18
for text, 52-53
controls. See also specific controls
adding at run time, 134-36
adding to pages, 49
binding to data
explicit, 195-96
overview, 146, 184, 191-94
syntax of, 199-201
for calendar applications, 262-63
for details pages of slideshows, 241-42
difficulty displaying in template editor, 197-98
for e-mail message pages, 286
in gray boxes, 154
groups of, 53
for guestbook pages, 163-64
for hit counters, 121, 134-36
for master pages of slideshows, 233-34
naming, 22
not visible in browsers, 154
positioning, 51-54
rendering as HTML, 61-62
for SendPicture.aspx page, 297-98
setting properties for, 55-57
for slideshow pages, 67-68
for user preferences pages, 87-90
for user validation in guestbooks, 174-75, 177-81
Controls collection, updating databases, 254-55
converting
characters in strings to HTML, 168, 237, 312-13
FAT to NTFS filing systems, 34
numbers to strings before displaying, 129
relative paths into full paths, 107
cookies
deleting in Internet Explorer, 130
hit counters using, 120-21, 126-28
overview, 95-96
reading, 98-100
session cookies, 96, 121
counters. See hit counters; random numbers, generating
crackers, 305, 306. See also security
Create New Table dialog box
calendar applications, 260
database-driven slideshows, 209-10
guestbooks, 161-62
illustrated, 162, 210
CreateSlideshow.aspx, 233-40, 256, 257
credentials. See passwords
cryptography
overview, 314
Rnd function and, 111
SSL and, 316
.css stylesheets, references to external stylesheets, 54
Custom Controls tab (Toolbox), 46
customized information, storing, 218
CustomValidator control
MaxLength property compared to, 234
minimum and maximum number of characters, 179-81
overview, 175
D
data. See also specific applications
caching in Session objects, 218
displaying
creating pages for, 153-55
customizing, 155-56
types of, 25
data access
configuring computers for, 37
objects used for, 141-45
overview, 33
SQL Server access and, 328
data binding
binding grids to results of queries, 275
data-bound pages, 156-58
displaying records on slideshow picker pages, 214, 215
explicit, 195-96
objects bound to columns in databases, 172
overview, 146, 183-86, 191-94
syntax of, 199-201
data input validation. See validation, of user input in guestbooks
Data Pages templates, 153
data reader objects
appointments in calendars, 270-72
overview, 144-45
Data tab (Workspace window), 46
data tables. See tables
database servers, connections established with, 142-43, 156-57
database tables, 217-18, 328-35
databases. See also specific applications
access permissions when hosting sites yourself, 324-25
connection objects and, 142-43, 156-57
creating
adding data to tables, 152-53
creating tables to store data, 148-52
establishing connections for runtime, 165
establishing connections to MSDE, 147-48, 161
reading values out of text boxes, 254-55
recommended reading, 140
secure access to, 317-20
support for, 139-41
validating user input, 175
DataBind method, 275
DataBinder objects, 193-94
data-binding expressions
defined, 191-92
in HTML view, 199-200
in templates, 195-96
DataBindings dialog box, 192-94
data-entry pages for master-details tables, 232-35
datagrids. See grids on data-display pages
DataList control
binding controls to data, 193, 194
creating pages using, 187-91
defining alternating items, 197, 200-201
HTML view, 198-99
overview, 183-86
programming, 195-96
DataNavigateUrlField, 239
DataNavigateUrlFormatString, 239
datasets
defined, 146
overview, 217-18
programming for slideshow viewer pages, 222-26
reading information from, 226-28
storing, 218
dates. See calendar applications
DateTime data type and slideshows, 212
date-time strings for calendar records, 266
defaults
in Start Web Application dialog box, 323
values in table columns, 150, 152
delimiters
characters used as, 104-5
splitting strings into parts based on, 112
deploying applications
to hosts, 325-34
to ISPs, 142
when hosting sites yourself (on local Web sites), 321-25
Design view. See also specific applications
grids on, 53
setting properties for controls in, 56
switching to, 50
Designing Relational Database Systems, 140
Designing Secure Web-Based Applications for Microsoft Windows 2000, 305
details pages in slideshows
adding slides, 244-45
creating, 241-42
deleting slides, 248-50
displaying list of slides, 245-48
editing slides, 250-52
navigating from master page, 238-40
reading from master page, 242-43
slideshow pages compared to, 241
updating databases, 252-55
detail records in Slideshows tables, 207
directories
organizing pictures for slideshows, 66, 206
for practice pages, 44
storing pages for IIS to find, 322-24
disconnected Web
each request treated as first-time request, 9
overview, 8-9
stateless pages, 9-10
DisplayCurrentSlide subroutine, 227-28
DNS, hosting sites yourself, 31
dots in Design view, 53
double-spaced lines, creating single-spaced lines instead of, 164
drop-down lists
adding to preferences pages, 88-90
creating in calendar applications, 263-64
dynamic Web pages, 5
E
e arguments, 59, 254, 255
Edit DataList Templates dialog box, 189-91
Edit Table dialog box, 210-11
elements. See also specific elements
formatting, 51, 262
positioning, 51-54
Else blocks. See If-Then blocks
e-mail alerts sent when guestbooks are updated, 291-94
e-mail fields in guestbooks, validating, 178-79
e-mail messages sent from applications
creating pages for sending, 285-91
HTML formatting in, 299-300
spam, 285
users sending pictures from slideshows, 294-301
e-mail servers, configuring, 278-85
emailMessage objects, 289
empty strings, 152
"Enabling and Disabling Dynamic Content," 312
encryption. See cryptography
end of file variables, 108-9
Enter key
ENTER+SHIFT creating single-spaced lines, 164
<p> tags, 54
Enterprise Manager (SQL Server), 256
eof variables, 108-9
error handling. See Try-Catch blocks
error messages. See also troubleshooting
e-mail messages and, 289
identifying, 71
for invalid user input, 173, 177-78, 179
security and, 238, 314-15
Eval method of DataBinder objects, 193-94
event handlers. See also specific handlers
creating, 57
OOP tenets, 24
overview, 59
events. See also specific events
compared to Visual Basic events and HTML events, 60-61
OOP tenets, 24
overview, 59
exception handling. See Try-Catch blocks
explicit conversion, 129
exporting database tables to hosts, 329, 330, 331-32, 335
ExportTable.aspx, 329, 330, 331-32, 335
expressions, 25-26
extensions. See specific extensions
F
F2, hiding Toolbox using, 156
F5, running pages using, 58
FAT filing system
configurations for sending e-mail messages, 282
NTFS compared to, 34, 308
security and, 308
field validation. See validation
file systems, NTFS compared to FAT, 34. See also specific systems
File Transfer Protocol (FTP), 325-28
files. See pages
filtering HTML user input, 312-13
firewalls, 32, 285, 307, 308
FirstWebPage.aspx
adding text and controls to, 49
creating, 45
positioning text and controls in, 52-53
programming buttons, 57
rendering controls as HTML, 61-62
setting properties for controls in, 55-57
testing, 58
flow mode, alternatives to, 51-54
folders. See directories
fonts, previews of user preferences, 93-94
footer templates, 194-95, 202
format expressions, 129
Forms authentication, 317
For-Next loops, 135
FriendsDisplay.aspx, 153-58
FTP (File Transfer Protocol), 325-28
fully qualified names
of data objects, 225
overview, 93
functions, 28
G
General template, 44-45
GetAppointments method, 270, 271
Gibson Research Web site, 307
GIF files, hit counters using, 132
graphics. See pictures
graphics files and hit counters. See also pictures
creating files, 132-34
displaying, 134-36
gray boxes, controls in, 154
grids on data-display pages. See also MxDataGrid control
customizing displays, 155-56
customizing guestbook displays, 172-73
MxDataGrid control and, 157-58
positioning elements using, 53
groups of controls, creating, 53
Guestbook.aspx pages
adding validation to, 176-81
creating, 163-64
editing connection strings in, 334
sending e-mail alerts from, 291-94
Guestbook_Email.aspx pages, 291-94, 334
guestbooks
creating
database table, 160-62, 187-91
pages for adding entries, 163-70
pages for displaying listings, 170-73
displaying listings
alternating items, 197-201
creating pages for, 170-73
templates for, 184-85, 197-201
testing, 196-97
e-mail alerts sent when updated, 291-94
illustrated, 160, 163
preventing script injection attacks, 167-68
signing, Click event handlers for, 292-94
validating user input
Comments fields, 179-81
e-mail fields, 178-79
Name fields, 177-78
overview, 173-76
H
hackers, 305. See also security
Halvorson, Michael, 22
hard-coding. See also Code view
adding captions to slideshows, 81-82
e-mail messages links to pictures, 299-300
pages for e-mail messages, 288-91
paths of files, 107
slide lists in slideshows, 68-70
header templates, 194-95, 202
hidden fields (HTML elements) and viewstate, 72
hiding/showing caption labels, 91
hit counters
adding leading zeros, 129
commercial services for, 119
controls for, 121
cookies used with, 120-21, 126-28
counter logic
creating, 123-24
displaying counters, 128-29
getting current counter, 125-26
incrementing counters, 126-28
creating pages for counting hits, 121-23
defining hits, 119-20
graphical numbers used for, 131-36
illustrated, 118, 122, 132
overview, 117-19
reading from, 123, 125-26
testing, 130-31
writing to text files, 123, 126-28
HitCounter.aspx, creating, 121-23
hosting sites
allowing e-mail messages to be sent from pages, 277
ASP.NET-friendly hosts, 31
deploying applications, 325-34
hosting yourself
deploying applications, 321-25
IIS and, 35
overview, 31-33
permissions, 34-35
security, 307-10
"HOW TO: Secure XML Web Services with Secure Socket Layer in Windows 2000," 316
Howard, Michael, 305
HTML
converting characters in strings to, 168, 237, 312-13
e-mail alerts for guestbook updates, 293
pictures attached to as e-mail attachments, 299-300
rendering controls as, 61-62
HTML & XML for Beginners, 12
HTML elements
customizing format of, 51
viewing, 50
HTML Elements tab (Toolbox), 46
HTML events, 60
HTML view
guestbook display templates in, 198-200, 201
setting properties in, 55-56
switching to, 50
HyperLinkField, 238-39
hyperlinks, adding to slideshow pages, 239-40
I
identifiers, sequential numbers as, 148, 149-50, 151
IE (Internet Explorer)
bugs in version 6.0, 197-98
deleting cookies in, 130
installing, 35
If-Then blocks
hit counters using, 125
in Next and Previous buttons, 76-77
programming previews of user preferences for fonts, 93
IIS (Internet Information Services)
hosting sites yourself, 322-24
installing, 35, 36
ISPs running, 30
recommended reading, 309
security improvements in version 6.0, 312
as server software, 6
SMTP virtual server acting as e-mail server, 278-85
SSL and, 316
illustrations. See pictures
Image control. See also pictures
displaying graphical numbers in, 134-36
properties of, 67, 69
setting sizes of images, 68
implicit conversion, 129
importing database tables to hosts, 329, 330, 332-33, 335
importing (referencing) namespaces, 93
ImportTable.aspx, 329, 330, 332-33, 335
input validation. See validation, of user input in guestbooks
Insert Data Method element, 165-67, 265
InsertCalendar function, 266
instances of objects, 23-24, 161
Int data type, 149, 151
integrated security, 142
Internet Explorer
bugs in version 6.0, 197-98
deleting cookies in, 130
installing, 35
Internet Information Services. See IIS
Internet service providers (ISPs). See also hosting sites
finding ASP.NET-friendly, 30
security when deploying applications to, 142
"An Introductory Guide to Building and Deploying More Secure Sites with ASP.NET and IIS," 309
IP addresses
hosting sites yourself, 31
routers and, 307
security, 306
Is Nothing test
hit counters and, 127
overview, 27
random quotes pages and, 109
ISPs (Internet service providers). See also hosting sites
finding ASP.NET-friendly, 30
security when deploying applications to, 142
Item property, updating databases, 253, 254
Item template, 185
J
JavaScript events, 60
JPG files, hit counters using, 132
L
Label controls
adding for slideshow captions, 80-82
editing Text property of, 56-57
labelDate control, 264-65
labelFrom control, sending e-mail messages, 289
labelStatus control, sending e-mail messages, 289
LANs (local area networks), SMTP virtual server configurations, 282
least privileges principle, 308
left angle bracket (<), converting to HTML, 168
lifetimes of cookies, 96, 97
limiting
HTML characters in strings, 312-13
length of strings, 135
line breaks in text files, 104-5
list box controls, 213-14
listAMPM control, 264
ListBox control on slideshow picker pages
AutoPostBack property, 214
programming, 216
text setting, 213
value setting, 213-14
listHour control, 263
ListItem Collection Editor dialog box, 88-90, 263
listMinutes control, 263
lists displayed on pages. See also DataList control; guestbooks, displaying listings
adding drop-down lists to preferences pages, 88-90
bulleted, creating, 202-3
creating drop-down lists in calendar applications, 263-64
slides in slideshows, 238-40, 245-48
Listservs for Web Matrix community, 48
literal text, 24
Load events, 59
local area networks (LANs), SMTP virtual server configurations, 282
lockdown, 32-33, 308
logging in
connection objects and, 142
creating forms for, 315-17
database access and, 318-20
logging processes, 310
login forms, 315-17. See also passwords
loops
end of file variables and, 109
hit counters using For-Next loops, 135
list of dates in calendar appointments, 270
random quotes pages using, 107-9
tenets of OOP, 27-28
M
MailAttachment object, 299-300
MailMessage objects, 289, 293
master pages in slideshows
adding records to databases, 235-38
creating, 232-35
displaying list of slides, 238-40
navigating to detail pages, 238-40
reading slideshow names from, 242-43
master records in Slideshows tables, 207
master-details tables
authentication, 232
overview, 207-12
synchronizing information stored in multiple places, 256-57
MaxLength property, 234
.mdb files, support for, 140-41
memory
binary data stored in databases, 209
releasing by closing objects, 109
Session objects and, 219
writing data to disk, 128
menus, 46
messages for visitors. See also error messages
entering calendar records, 267
entering guestbook entries, 170
sending e-mail messages, 289
sending pictures in e-mail messages, 301
methods. See also specific methods
result sets and, 144
tenets of OOP, 24
Microsoft Access, support for, 140-41
Microsoft Baseline Security Analyzer, 309
Microsoft Communities Web site, 48
Microsoft Internet Explorer
bugs in version 6.0, 197-98
deleting cookies in, 130
installing, 35
Microsoft SQL Server. See SQL Server
Microsoft Visual Basic .NET Step by Step, 22
Microsoft Windows
installing, 34
.NET Framework relationship to, 17-18
Microsoft Windows .NET Server 2003 security improvements, 312
mixed mode security, 142
Morrison, Michael, 12
MSDE 2000 (Microsoft SQL Server Desktop Engine 2000). See also SQL Server
configuring when hosting sites yourself, 324-25
establishing connections with, 147-48, 161
getting names of instances, 161
installing, 37-39
integrated security, 142
overview, 33
referential integrity, 256
security, 318
support for, 140-41
transferring tables to hosts, 329-34
MxDataGrid control
attributes and subelements of, 157-58
DataList and Repeater controls compared to, 172
deleting slides using, 248-50
displaying
calendar appointments, 273-74, 275-76
guestbook listings, 171, 172-73, 183
slides, 241
slideshows using, 234-35
editing properties of, 155
editing slides in slideshows, 250-52
navigation added to, 238-40, 245-48
overview, 154
updating databases, 253-55
MxDataGridField Collection Editor dialog box, 172, 246, 249
My Snippets tab (Workspace window), 46
N
Name fields in guestbooks, validating, 177-78
names of slideshows, reading from master pages, 242-43
namespaces
adding references to pages, 288
overview, 92-93
naming
controls, 22
slides, 212
slideshows, 210, 237
navigation controls on slideshow pages
adding navigation bars to, 77-79
consolidating repetitious code, 82-83
details pages, 238-40
Next and Previous buttons, 74-77, 227-28
NChar and NVarChar data types, 151-52
.NET Framework
changes in HTML filtering in version 1.1, 313
installing, 36-37
overview, 16, 17-18
New FTP Connection dialog box, 326-28
New Message button, creating, 290
newsgroups for Web Matrix community, 48
NewValues collection, 255
Next and Previous buttons, 74-77, 227-28
normalized information in tables, 207
NTFS filing system
configurations for sending e-mail messages, 282-84
FAT compared to, 34, 308
security and, 308
null values, 152
numbers. See also hit counters
converted to strings before displaying, 129
generating random numbers, 110-11
graphical numbers used for hit counters, 131-36
maintaining slide numbers in viewstate, 71-74
sequential numbers as identifiers, 148, 149-50, 151
O
objects. See also specific objects
closing, 109
used for data access, 141-45
OOP (object oriented programming), 23-28
OOP with Microsoft Visual Basic .NET and Microsoft Visual C# Step by Step, 22
Open Items tab (Workspace window), 47
operators. See also specific operators
tenets of OOP, 25-26
validator controls, 174
Order By clauses
displaying calendar appointments, 273
sorting entries in guestbooks, 171
osql utility (MSDE), 256, 324-25
output, ASP.NET handling, 7
P
<p> tags
creating <br> tags instead of, 164
inserted by Web Matrix, 54
Page_Load event handlers
binding controls to data in templates, 196
binding data to display records on slideshow picker pages, 215
creating, 106-7
creating slide lists, 69
displaying calendar appointments, 276
displaying slides for current slideshow, 246-47
hit counters, 124-29
login forms, 317
maintaining slide numbers in viewstate, 74
random quotes generated, 105-16
reading cookies, 98-100
reading slideshow names from query strings, 242-43
run time controls, 134-36
SelectedDate property of Calendar control, 264
slideshow viewer pages, 222
storing datasets in Session objects, 225
pages. See also specific applications
adding text and controls to, 49
ASP.NET and, 6-7
copying to hosts, 325-28
creating, 45
processes involved in working with, 29-30
as programs, 4-6
providing access to, 30
refreshing, 75
setting properties for, 56
testing and running, 30-33, 58, 75
users sending contents of, 294-301
paging through slides. See navigation controls on slideshow pages
Panel controls, 52-53
parameterized SQL statements, 247, 318
Parameters collection, 247, 318
Parameters property of command objects, 144
passwords
authentication, 315-17
cryptography, 314
explicit credentials, 318-20
hosting sites yourself, 308
validating, 174
patches and security, 33, 309
paths of files, 70, 107
pattern matching, 175-76
permissions. See also security
anonymous users and security, 310-12
database access, 318-20
hosting sites yourself, 308
sending e-mail messages, 280-85
site development, 34-35
writing files to folders, 124
persistent information, 96, 97
pictures. See also Image control
on companion CD, 66, 206
graphical numbers used for hit counters, 131-36
organizing for slideshows, 66, 206
users sending from slideshows, 294-301
Web-friendly formats, 66
pipe character (|)
converting to different character, 111-12
in text files, 104-5
PlaceHolder control, 134
plain text e-mail messages, 289. See also text files
PNG files, hit counters using, 132
ports, security, 307, 308
positioning text and controls, 51-54
postbacks. See also round trips
AutoPostBack property, 101, 214
defined, 8
hit counters and, 125
overview (in action), 61
Page_Load event handlers and, 106
storing values between, 114-15
viewstate and, 72-73, 74
<pre> tags, 54
preferences pages, 86-90. See also user preferences; specific preferences
preserving data. See storage and storing data
Preview buttons, programming, 91-95
previews of user preferences, 91-95, 101-2
Previous buttons, programming, 74-77, 228
primary key constraint violation, 237
primary keys
auto-incrementing, 210, 212, 333
columns in tables for, 151
duplicate values, 237
identifiers as, 149-50
privacy and cookies, 96
privileges. See permissions
programming languages. See specific languages
properties. See also specific properties, objects, and controls
of controls, 55-57
of objects, 24
Properties window
illustrated, 46
overview, 47
setting properties for controls using, 55-57
Q
Query Builder dialog box, 165-66, 223
query strings. See also strings
passing slideshow information using, 214, 216, 239
reading slideshow names from, 239, 242-43
in URLs, 214-15
question marks (?)
regular expressions and pattern matching, 175
in URLs, 215
quotes ("), 150, 152
quotes pages. See random quotes pages
R
radio button controls, 87
random numbers, generating, 110-11
random quotes pages
caching quotations, 114-16
error handling, 109-10
finding quotations files, 107
generating random numbers, 110-11
getting and displaying quotations, 111-12
reading text files, 105-9
testing, 113-14
writing to text files, 104-5
RandomQuotes.aspx
caching, 115-16
creating, 105-7
RangeValidator control, 174
ReadLine method, 107
recommended reading
ASP.NET, 12
database knowledge, 140
filing systems, 308
firewalls, 307
Forms authentication, 317
hosting sites yourself, 31
HTML, 12
regular expressions, 176
security, 305, 309
security improvements in IIS 6.0, 312
SSL, 316
validator controls, 175
Visual Basic .NET, 22
XML, 12
records. See databases; specific applications
Redirect method of Response objects, 216
references
to namespaces, 93
to pictures stored in databases, 208-9
resolving to external stylesheets, 54
referential integrity, master-details tables, 256-57
refreshing (reloading) pages, 75, 265. See also round trips
Regular Expression Editor dialog box, 178
regular expressions
overview, 175-76
validator controls, 174, 178-79
RegularExpressionValidator control
on e-mail message pages, 287
on guestbook pages, 174, 178-79
relative paths, 70, 107
Relay Restrictions dialog box, 281-82
reloading pages, 75, 265. See also round trips
reminder features of calendar applications, 267
Repeater control, 183-85, 201-3
Replace method of String object
filtering HTML user input, 313
pipe characters with line break and dash, 111-12
Request objects, 99-100
Request.ApplicationPath method, 107
required field validation, 174, 177-78
RequiredExpressionValidator control, 174
RequiredFieldValidator control, 174, 177-78, 180
resizing
images, 68
pages, 156
Response objects
cookies controlled using, 96-97
cookies sent to browsers using, 126-27, 128
requests sent to browsers using, 216
restrictions. See permissions
result sets, 144-45
Reynolds-Haertle, Robin A., 22
Riordan, Rebecca M., 140
Rnd function, 110-11
round trips. See also postbacks
clicking on dates in calendar and, 265
defined, 8
overview (in action), 61
preserving data, 145-46
preserving datasets, 224-25
requests treated as first-time request, 9
routers and security, 32, 307
routines and subroutines
consolidating repetitious code, 82-83
displaying calendar appointment details, 274-76
displaying calendar appointments, 270-71
event handlers and subroutines, 59
subroutines defined, 28
S
Save Preferences button event handler, 96-97
saving
templates, 190
user preferences, 95-97
scheduling. See calendar applications
schema of MSDE tables, copying to hosts, 329
script injection attacks (script exploit), 167-68, 317-18
search engines, postbacks and round trips, 8
"Secure Internet Information Services 5 Checklist," 309
Secure Sockets Layer (SSL), 316
"Secure XML Web Services with Secure Socket Layer in Windows 2000," 316
security
ASPNET account and anonymous users, 310-12
authenticating with login forms, 315-17
crackers and hackers
defined, 305
motivations of, 306
cryptography, 111, 314, 316
database access, 317-20
data-entry pages for slideshows, 236-37
error messages and, 238
exporting and importing pages to hosts, 335
firewalls, 32, 285, 307, 308
hosting sites yourself, 32, 307-10
HTML formatting in e-mail messages, 293, 299-300
integrated, 142
lockdown, 32-33, 308
malicious user input, 312-13
master-detail tables, 232
mixed mode, 142
passwords
authentication, 315-17
cryptography, 314
explicit credentials, 318-20
hosting sites yourself, 308
validating, 174
patches, 33
permissions
anonymous users and security, 310-12
database access, 318-20
hosting sites yourself, 308
sending e-mail messages, 280-85
site development, 34-35
writing files to folders, 124
preventing script injection attacks, 167-68, 317-18
query strings, 215, 242
recommended reading, 305, 307, 308, 309
routers, 32, 307
sensitive information, 314-15
SMTP virtual server and, 284-85
Security tab of Properties dialog box, 282-84
Select statements, 245, 247-48
SelectCommand attribute of SqlDataSourceControl, 157, 187-88
SelectedDate property of Calendar control, 264, 265
SelectedDates collection, 270-71, 275-76
selection events, 59
SelectionChanged event handler, 264, 274-76
Send method of SmtpMail objects, 289-90
Send This Picture button, adding to slideshow pages, 295-96
SendEmail.aspx page
adding namespaces to, 288
creating, 286-87
sender arguments (event handlers), 59
SendPicture.aspx page, 296-301
separator templates, 194-95
server controls, 62
server software, 6
server-based programming
browser-based programming compared to, 11
characteristics of, 7-10
overview, 4-6
Server.HtmlEncode method
filtering HTML user input, 313
inserting into databases
calendar records, 266
slides, 245
slideshows, 236-37
overview, 168
Server.MapPath method, 107
servers. See also MSDE 2000; SMTP; SQL Server
database servers, connections established with, 142-43, 156-57
defined, 6
overview, 4-6
security and server names, 314
testing pages, 29-30
validating, 180
ServerValidate event handlers, 180
session cookies, 121
Session objects
caching data in, 218
disadvantages of, 219
overview, 218
storing datasets in, 224-25
storing user names in, 316-17
ShieldsUp! Web site, 307
SHIFT+ENTER, creating single-spaced lines using, 164
Simple Mail Transfer Protocol (SMTP) virtual server
installing and configuring, 279-84
overview, 278-79
single-spaced lines, creating, 164
size
enlarging page displays, 156
resizing images, 68
viewstate affecting downloaded pages, 73
slash characters (\), MapPath methods and, 108
slide arrays, 69-70
slide lists
absolute and relative paths, 70
building, 68-69
datasets and, 217-18
in detail pages, 245-48
hard-coding, 68-70
loading, 69-70
in master pages, 238-40
slides
deleting from slideshows, 248-50
displaying, 226-28, 245-48
displaying lists of, 238-40, 245-48
editing, 250-52
information about, 207-8
inserting into databases, 243-45
maintaining slide numbers in viewstate, 71-74
Slides table, 207-8
slideshow picker pages
creating, 212-14
illustrated, 206
programming, 214-16
slideshow viewer pages
creating, 219-21
navigating between slides, 228
programming, 221-29
testing, 224, 229
SlideShow1.aspx, creating, 67-68
Slideshow_Email.aspx, 295-96, 298
SlideshowPicker.aspx, 213-16
slideshows
adding
captions to, 80-82
controls to, 67-68
records to databases, 235-38
creating pages for, 67-68
creating slideshow tables, 209-12
database structure, 207-9
deleting slides from, 248-50
detail pages
adding slides, 244-45
creating, 241-42
deleting slides, 248-50
displaying list of slides, 245-48
editing slides, 250-52
navigating from master pages, 238-40
reading from master pages, 242-43
slideshow pages compared to, 241
updating databases, 252-55
displaying slides for, 226-28, 245-48
initializing pages, 69-70
maintaining slide numbers in viewstate, 71-74
master pages
adding records to databases, 235-38
creating, 232-35
displaying list of slides, 238-40
navigating to detail pages, 238-40
reading slideshow names from, 242-43
naming, 210, 237
navigation controls
adding navigation bars, 77-79
consolidating repetitious code, 82-83
details pages, 238-40
Next and Previous buttons, 74-77, 227-28
organizing pictures for, 66, 206
overview, 65-66
testing pages, 70-71
timers for, 66
updating databases, 252-55
users sending pictures from, 294-301
SlideshowViewer.aspx, 220-29
smart host computers, 282
SMTP (Simple Mail Transfer Protocol) virtual server
installing and configuring, 279-84
overview, 278-79
SmtpMail objects, 289
SmtpMail.Send method, 289-90, 293, 294
software required for Web Matrix, 33-39
sorting
entries in guestbooks, 171
properties in Properties window, 55
spaces
blank lines in text files, 105
in folder names, 322
spacing, creating single-spaced lines, 164
spam e-mail, 285
spoof, 215
spreadsheets, text formatting differences, 54
SQL Server. See also MSDE 2000
access across the Web, 328
access permissions, 324-25
connection objects and, 142-43
referential integrity, master-details tables, 256-57
security, 314, 318
support for, 140-41
SQL Server Service Manager dialog box, MSDE instance name in, 161
SQL statements
builders for, 187
malicious user input, 317-18
in .schema files, exporting and importing tables to hosts, 329
SqlDataReader, 271. See also data reader objects
SqlDataSourceControl control
adding to guestbook listing pages, 187-88, 189
deleting slides from slideshows using, 248
displaying calendar appointments using, 273, 275
displaying guestbook listings using, sorting entries, 170-71
displaying slides for current slideshow, 246-47
editing connection strings in, 334
editing slides in slideshows using, 250
overview, 154, 156-57
updating databases, event handlers for Update buttons, 252
SSL (Secure Sockets Layer), 316
Start Web Application dialog box
overview, 58
virtual roots and, 323
starting Web Matrix, 44-45
state, maintaining
datasets, 218, 224-25
round trips and viewstate, 146
slide numbers and viewstate, 71-74
stateless pages, 9-10
static HTML pages, 4
storage and storing data. See also cache
binary data, 208-9
caption text, 80-82
connection strings, 318-20
cookies, 96
creating tables for, 148-52
customized information, 115
datasets, 218, 224-25
drop-down list items in collections, 89
pages for IIS, 322-24
random quotes text, 107-8
sensitive information, 314
slide information, 207-8
SQL statements, 329
strings stored in viewstate, 72, 73
synchronizing information stored in multiple places, 256-57
user names, 316-17
values between postbacks, 114-15
StreamReader objects
hit counters using, 125-26
random quotes pages using, 107-9
streams
capturing, 107-9
reading single values out of, 125
StreamWriter objects, hit counters using, 127
String object filtering HTML user input, 313
strings
breaking up, 112
characters in. See also specific characters and types of characters
converting to HTML, 168, 237, 312-13
delimiters, 104-5, 112
extracting, 135, 175
wildcard characters and pattern matching, 175
connection strings
builders for, 187
editing when moving data tables to hosts, 333-34
security and, 314, 318-20
converting numbers to, 129
format expression, 129
query strings
passing slideshow information using, 214, 216, 239
reading slideshow names from, 239, 242-43
in URLs, 214-15
splitting strings into parts, 112
stored in viewstate, 72, 73
strong passwords, 308
<style> blocks, 54
styles, text formatting differences, 54
stylesheets, external, 54
subroutines and routines
consolidating repetitious code, 82-83
displaying calendar appointment details, 274-76
displaying calendar appointments, 270-71
event handlers and subroutines, 59
subroutines defined, 28
Substring method, 135
symbols. See characters in strings
System.Web.Mail namespace, 288
T
tables
for calendar applications, 260-61
columns in
binding controls to, 184, 191-94
for calendar information, 260
default column type, 150
defining, 151-52
creating
for calendar information, 260-61
for guestbooks, 161-62
overview, 148-52
database tables, 217-18, 328-35
DataList control rendered as, 185, 196-97
entering data into, 152-53
guestbook database tables, 187-91
inserting slides into, 243-45
loading into datasets, 226-28
master-detail tables
authentication, 232
overview, 207-12
synchronizing information stored in multiple places, 256-57
positioning text and controls, 51-53
slideshows and slide information in, 207-12
template editor
closing, 191, 198
saving templates in, 190
templates. See also specific templates
for alternating items, 185, 197-201
binding controls to data, 184, 191-94, 195-96, 199-201
creating, 184
Data Pages, 153
defined, 184
footer templates, 194-95, 202
for guestbook displays, 184-85, 197, 200-201
header templates, 194-95, 202
overview, 44-45
saving, 190
separator templates, 194-95
testing pages
guestbooks
display listings, 196-97
entry pages, 170
hit counters, 130-31
random quotes pages, 113-14
refreshing pages, 75
sending e-mail messages
from pages, 290-91
pictures attached to, 300-301
slideshows
picker pages, 229
viewer pages, 70-71
on your own computer, 58
text
adding captions to slideshows, 80-82
adding to pages, 49, 52-53
encrypting, 316
formatting, 54
positioning, 51, 52-53
tenets of OOP, 23-24
text boxes
adding
to pages, 49
to slideshow details pages, 241-42
to slideshow master pages, 233, 234
databases reading values out of, 254-55
on login forms, 315-16
on pages for sending e-mail messages, 289
text (character) columns, 151
text files
reading from, 105-9, 123, 125-26
security and, 319
writing to, 104-5, 124, 126-28
Text property of buttons, 55, 79
Text property of Label controls, 56-57
three-table database structure of slideshows, 208
timer countdowns for slideshows, 66
timers, Session objects and, 219
toolbars, hiding and docking, 46. See also specific toolbars
Toolbox, 46
ToString method, 129
troubleshooting. See also error messages
closing template editor, 191, 198
establishing connections with MSDE, 148
HTML filtering, 313
importing database tables, 333
Next buttons on slideshow pages, 76
pages reading from text files, 113-14
sending e-mail messages and, 290
slideshow pages, 71
Try-Catch blocks
calendars using, 266
guestbooks using, 170
hit counters using, 126, 128
random quotes pages using, 110
security and, 315
sending e-mail messages and, 289-90, 294
slideshows using, 237, 245
stopping applications, 126
TXT files. See text files
U
Update statement
editing slides in slideshows, 250, 251
event handlers for Update buttons, 252, 253-55
updating
databases, 252-55, 266
e-mail alerts sent when guestbooks are updated, 291-94
master-details tables
adding records to databases, 235-38
adding slides to details pages, 244-45
creating details pages, 241-42
creating master pages, 232-35
deleting slides from details pages, 248-50
displaying list of slides on details pages, 245-48
displaying list of slides on master pages, 238-40
editing slides, 250-52
navigating to details pages from master page, 238-40
reading details pages from master pages, 242-43
URLs
adding hyperlinks to slideshows, 239-40
query strings in, 214-15
user input
adding entries to guestbooks, 167-70
security against malicious input, 312-13, 316, 317-18
validating in guestbooks
comments field, 179-81
e-mail field, 178-79
overview, 173
validator controls, 174-75, 177, 178-81
user preferences. See also specific preferences
applying (reading), 97-100
creating preferences pages, 86-90
previewing, 91-95, 101-2
sample page saving preferences, 85
saving, 95-97
users
anonymous, 310-12, 315
authenticating using login forms, 315-17
V
validation
on e-mail message pages, 287
overview, 173
pattern matching, 175
required field validation, 174, 177-78, 179, 180
server validation, 180
of settings in Properties window, 56
of user input in guestbooks
comments field, 179-81
format of e-mail field, 178-79
overview, 173
validator controls, 174-75, 177, 178-79
validator controls
for e-mail message pages, 287
for guestbook pages, 174-75, 177, 178-79
security and, 315
for sending pictures as e-mail message pages, 297
VarChar and Char data types, 151-52, 212
variable declarations
tenets of OOP, 24-25
when building slide lists, 68-69
VB.NET. See Visual Basic .NET
VBScript events, 60
View Guestbook pages, 172-73, 187-91
ViewCalendar.aspx, 269
ViewGuestbookGrid.aspx, 171-73
ViewGuestbookList.aspx, 187-91, 200-201
ViewGuestbookList_Repeater.aspx, 202-3
views of documents, switching, 50-51
viewstate
maintaining slide numbers in, 71-74
maintaining values during round trips, 146
overview, 72-73
virtual paths, 107
virtual root, configuring IIS for, 322, 323-24
virtual server (SMTP)
installing and configuring, 279-84
overview, 278-79
virus checkers, 310
visitors. See also user input; user preferences
adding entries to guestbooks, 167-70
anonymous, 310-12, 315
authenticating using login forms, 315-17
Visual Basic events, 60
Visual Basic .NET
syntax of, 23
tenets of OOP, 23-28
using with Web Matrix, 20-21
Visual Studio .NET compared to Web Matrix, 20
vulnerabilities, 306, 309. See also security
W
Web Controls tab (Toolbox), 46
Web Forms pages. See also specific applications
adding text and controls to, 49
event handlers for, 59
events, 60-61
positioning text and elements, 51-54
programming buttons, 57
rendering controls, 61-62
setting properties for controls, 55-57
testing, 57-58
Web Matrix
community support for, 19, 47-48
development environment, 46-47
installing, 37
overview, 18-20
starting, 44-45
Visual Studio .NET compared to, 20
work area, 46-47
Web pages. See pages
Web server root folder, storing pages for IIS to find, 322-24
Web servers. See servers
Web sites
ASP.NET and Web Matrix, 19
calendar control sample, 259
downloading Internet Explorer, 35
Microsoft Communities, 48
Microsoft Security, 33
port-scanning, 307
validator controls samples, 175
Web Matrix community, 47
Web.config file, storing connection strings in, 319-20
"What's Changed," 312
WHERE Clause Builder dialog box, 223-24
Where clauses
displaying calendar appointments, 273, 275
displaying slides for current slideshow, 246
selecting slides for slideshow viewer pages, 223-24
while loops, 109
wildcard characters, 175
Windows
installing, 34
.NET Framework relationship to, 17-18
Windows integrated security, 318
Windows Messenger used for conversations with community contacts, 47
<wmx:> prefix, 158
Workspace tab (Workspace window), 46
Workspace window
FTP sessions, 327, 328
illustrated, 46
making more room for (hiding Toolbox), 156
overview, 46-47
wraparound logic in Next and Previous buttons, 76
X
x and y coordinates, positioning text and controls using, 52
Z
zeros added to beginning of hit counters, 129
ZIP codes, validator controls for, 174
zombies, crackers turning machines into, 306
Last Updated: January 4, 2003
|