Analytics class, 299
ASP.NET Web Helpers Library
Analytics class, 299
Xbox Live Gamer Card, 295
ASP.NET Web Pages, 6
cookies, 122
limitations, 123
debugging
HTTP requests analysis, 452–453
Microsoft Visual Studio, 453
Mozilla Firefox Firebug, 452
object information display, 446–447
server information display, 444–446
tools of Google Chrome Developer, 451
tools of Internet Explorer developer, 450–451
tools of web browsers, 449
deployment
configuring external database connections, 470–471
finding hosting provider, 464–468
Publish Settings, 468
PublishSettings file, 469
Helpers, 117
App_Code folder, 118
pre-written helpers, 117
ProductInfo helper, 118
layout, 103
optional section, 114
passing data to layout and partial pages, 114–117
RenderSection() method, 110–113
maintaining session state, 121
identifiers, 121
variables, 121
search engine optimization (SEO), 457–462
other Web sites analysis, 464
startup code, 123
Application Level Code, 123–124
syntax, 95
adding single-line server-side code, 96–97
Razor parser, @ symbol, 100–103
URLs, 125
and routing, 126
Booleans, 54
C# Coding Conventions, 54
C# Primer
collections
conditions
dynamic variable, 92
ExpandoObject(), 92
loops
do loop, 81
while loop, 80
object oriented programming (OOP)
anonymous types, 91
constructors, 87
events and delegates, 87
generics, 91
principles and terminology, 83
static classes and members, 87–88
operators
equality, 67
types and variables
Booleans, 54
C# Reserved words, 53
Changing case, 60
Chart helper
creating chart using .NET collection, 208
AddSeries() method, 208
AddTitle() method, 208
generic dictionary collection, 209
Write() method, 208
creating chart using database query, 209
AddSeries() method, 210
AddTitle() method, 210
column chart, 211
Database.Query() method, 210
DataBindTable(), 210
DataBindTable() method, 210
products data, 210
Query() method, 210
sales table schema, 209
Write() method, 210
displaying chart in web page, 211–212
displaying different chart types, 213
saving charts, 216
styling and formatting WebMatrix charts, 214
AddLegend() method, 215
built-in themes, 214
specifying theme and displaying chart legend, 216
Client-side validation, 152–154
Concatenation and StringBuilder, 61–62
Confirming registration by email
account confirmation page, 263–264
generating and sending confirmation email, 261–263
Constructors, 87
Content protection
restricting to authenticated users
better user experience, 243–245
folder level access restriction, 241–243
page level access restriction, 241
roles
listing and adding roles, 245–248
listing role members and adding users to roles, 248–252
removing users from roles, 252–253
restricting access using roles, 255
updating AccountSummary Helper, 256
Cookies, 122
limitations, 123
Create Read Update and Delete (CRUD) operations, 171
Cross-browser compatibility issues, 34
Cross-site request forgery (XSRF), 158–159
Cross-site scripting (XSS), 155–158
CRUD. See Create Read Update and Delete (CRUD) operations
CSS styles, 381
Data access in WebMatrix
database connection, 183
editing existing data, 190–195
retrieving and displaying data, 184–186
Data types, SQL Server Compact Edition database
bigint, 173
binary, 173
bit, 174
datetime, 174
float, 174
image, 174
int, 174
money, 174
nchar, 174
ntext, 174
numeric, 174
nvarchar, 174
real, 175
rowversion, 175
smallint, 175
tinyint, 175
uniqueidentifier, 175
varbinary, 175
Database.Query() method, 202
HTTP requests analysis, 452–453
Microsoft Visual Studio, 453
Mozilla Firefox Firebug, 452
object information display, 446–447
server information display, 444–446
tools of Google Chrome Developer, 451
tools of Internet Explorer developer, 450–451
tools of web browsers, 449
Deployment, 7
configuring external database connections, 470–471
finding hosting provider, 464–468
Publish Settings, 468
PublishSettings File, 469
do loop, 81
Don't Repeat Yourself (DRY) principle, 103
E-commerce Site. See TechieTogs application
Events and delegates, 87
Execute() method, 189
ExecuteNonQuery() method, 189
helpers requiring initialization, 287–293
using without registration or initialization, 284–287
Floating-point types, 56
<form> tag, 129
Forms and validation
HTML form helpers
Html.CheckBox(), 140
Html.DropDownList(), 142
Html.Label(), 144
Html.ListBox(), 144
Html.RadioButton(), 141
Html.TextArea(), 141
Html.TextBox(), Html.Password() and Html.Hidden(), 139
HTML forms
<textarea> element, 137
label and fieldset tags, 137–139
security
cross-site request forgery (XSRF), 158–159
cross-site scripting (XSS), 155–158
validating user input
client-side validation, 152–153
combination of client and server-side validation, 153, 155
server-side validation, 151–152
validation
with WebMatrix
accessing submitted form data, 148–151
identifying form submissions, 146–148
Generic collections
Dictionary<TKey, TValue>, 73
IEnumerable<T>, 74
List<T>, 72
var keyword, 74
Google +1 Helper Package, 320–321
GUIDs, 421
Helpers, 117
App_Code folder, 118
pre-written helpers, 117
ProductInfo helper, 118
Html.CheckBox(), 140
Html.DropDownList(), 142
Html.Label(), 144
Html.ListBox(), 144
Html.RadioButton(), 141
Html.TextArea(), 141
Html.TextBox(), Html.Password() and Html.Hidden(), 139
HTTP post method, 186
IComparable interface, 166
Images
adding text as a watermark, 429–431
adding watermarks, 428
flipping and rotating, 426–428
using another image as a watermark, 431–434
Integrated development environment (IDE). See Microsoft WebMatrix
Interacting with data, 177
deleting data, 182
delete command, 182
WHERE clause, 182
fetching data, 178
like statement, 179
sorting by multiple columns, 181
sorting in reverse-alphabetical order, 180
inserting data, 181
updating data, 182
Label and fieldset tags, 137–139
Microsoft WebMatrix
database connection, 183
editing existing data, 190–195
helpers, 197
Chart helper (see Chart helper)
WebGrid helper (see WebGrid helper)
Integrated Development Environment (IDE), 30
Navigation and Content Panes, 32, 33
Notifications Area, 33
Ribbon Control, 32
Workspace Selector, 31
Microsoft Web Platform Installer
accepting license terms, 14
home page, 12
Install button, 14
installation page, 13
QuickStart page, 15
shortcut, 13
toolset (see WebMatrix toolset)
User Account Control dialog box, 13
retrieving and displaying data, 184–186
Web Sites, 18
Bakery template, 27
Empty Site template, 25
My Sites option, 18
Photo Calendar template, 27, 29
Photo Gallery template, 27, 28
Site from Folder option, 24
Site from Template option, 24, 25
Site from Web Gallery option, 19–23
Mozilla Firefox Firebug, 452
Numeric types
floating-point types, 56
Object oriented programming (OOP)
anonymous types, 91
constructors, 87
events and delegates, 87
generics, 91
principles and terminology, 83
static classes and members, 87–88
Protecting content. See Content protection
PublishSettings File, 469
QuerySingle() method, 193
Razor
comments, 100
cookies, 122
limitations, 123
Helpers, 117
App_Code folder, 118
pre-written helpers, 117
ProductInfo helper, 118
layout, 103
optional section, 114
passing data to layout and partial pages, 114–117
RenderSection() method, 110–113
maintaining session state, 121
identifiers, 121
variables, 121
startup code, 123
Application Level Code, 123–124
syntax, 95
adding single-line server-side code, 96–97
Razor parser, @ symbol, 100–103
URLs, 125
and routing, 126
Razor syntax, 50
Real-world development, 7
Robots Exclusion Protocol, 25
Robots.txt, 25
Search engine optimization (SEO), 7, 457–462
other Web sites analysis, 464
Security and membership
AccountSummary helper, 232–234
content protection
restricting to authenticated users, 241–245
Logout Page, 237
new user registration page creation, 228–232
storing additional user information, 257–259
confirming registration by email, 260–264
WebSecurity Helper setting, 225–228
Security and web site membership, 7
Server-side validation, 151–152
Session state, 121
identifiers, 121
variables, 121
Shopping cart
adding ‘Continue Shopping’ and ‘Proceed to Checkout’ buttons, 344–346
CartItem Class, 336
displaying empty cart, 339–340
displaying product title, 341–342
Social network integration, 7
SQL derver compact edition, 7
SQL Server Compact Edition, 7
SQL Server Compact Edition database
connecting to SQL Server or MySQL database, 221
creating new connection, 222–223
web.config file, 223
creating tables, 172
column properties, 173
data types, 173
table design tool, WebMatrix IDE, 172
data access in WebMatrix, 183
database connection, 183
editing existing data, 190–195
retrieving and displaying data, 184–186
deleting data, 182
delete command, 182
WHERE clause, 182
fetching data, 178
like statement, 179
sorting by multiple columns, 181
sorting in reverse-alphabetical order, 180
inserting data, 181
migrating SQL server database, 220
Migrate button, 221
Migrate Database dialog, 221
updating data, 182
WebMatrix helpers, 197
Chart helper (see Chart helper)
WebGrid helper (see WebGrid helper)
Startup code, 123
Application Level Code, 123–124
Static classes and members, 87–88
String length, 60
String.Format(), 60
Strings
changing case, 60
concatenation and StringBuilder, 61–62
string length, 60
String.Format(), 60
ToString(), 59
TechieTogs application
Account Summary Helper, 384–385
adding database
adding data to tables, 308–309
adding product images, 405–408
displaying product images, 409–413
adding social networking features
adding Google +1, Twitter, and Facebook buttons, 321–322
Google +1 Helper Package, 320–321
Admin area
creating Admin role, 378
creating and securing Admin folder, 379
checkout process
Order Complete page, 374
creating product catalog, 309–310
Product Listings page, 313–316
displaying dynamic content
error pages
displaying default error page, 327–329
produced by ASP.NET runtime, 327
produced by IIS, 326
orders administration
product administration
Products Summary page, 400–401
shopping cart
adding ‘Continue Shopping’ and ‘Proceed to Checkout’ buttons, 344–346
CartItem Class, 336
displaying empty cart, 339–340
displaying product title, 341–342
site administration home page, 383
Admin Menu, 380
user accounts
Account Summary Helper, 353–357
Forgotten Password page, 362–367
initializing membership system, 347
logout page, 359
registering new accounts, 348–352
requirement, 347
Ternary operator, 77
<textarea> element, 137
ToString(), 59
Transact-SQL, 177
T-SQL. See Transact-SQL
URLs, 125
and routing, 126
Videos
embedding flash video, 434–437
embedding Microsoft Silverlight video, 439–441
embedding Windows MediaPlayer video, 437–439
Watermarks
adding to, 428
using another image as, 431–434
Web design. See Microsoft WebMatrix
Web Helper packages
accessing Package Manager, 271–275
ASP.NET Web Helpers Library
adding search with Bing, 276–278
Analytics class, 299
Xbox Live Gamer Card, 295
Web.config file, 223
WebGrid helper
applying grid-wide styles, 203
alternatingRowStyle, 203
employee grid, 205
footerStyle, 203
GetHtml style parameters, 203
GetHtml() method, 203
headerStyle, 203
rowStyle, 203
selectedRowStyle, 203
tableStyle, 203
formatting columns, 199
Database.Query() method, 202
GetHtml() method, 201
WebGridColumn class, 201
WebGridColumn properties, 200, 202
pagination, 205
customizing pager control links, 207
employee grid, 206
WebGridPagerMode members, 206
WebGridColumn properties
CanSort, 200
ColumnName, 200
Format, 200
Header, 200
Style, 200
WebMatrix
ASP.NET Web Pages, 6
data-driven pages, 2
debugging, 7
deployment, 7
dynamic Web pages, 2
forms and validation, 7
installation, 6
interacting with databases, 7
language, 6
on-line community, 8
real-world development, 7
search engine optimization (SEO), 7
security and web site membership, 7
social network integration, 7
system requirements, 9
tools, 6
tools and technologies, 1
useful for, 6
WebMatrix Chart helper, types of, 213
WebMatrix IDE
Navigation and Content Panes, 32, 33
Notifications Area, 33
Ribbon control, 32
Workspace Selector, 31
Databases workspace, 32
Files workspace, 31
Reports workspace, 32
Site workspace, 31
WebMatrix toolset
ASP.NET Web Pages, 16
ASP.NET Web Pages Language Packs, 18
Integrated Development Environment (IDE), 17
Microsoft SQL Server Compact 4.0 Tools, 17
SQL Server Compact 4.0, 17
SQL Server Management Objects component, 18
SQL Server Native Client, 17
SQL Server System CLR Types package, 17
Web Deployment Tool, 18
configuring site, 21
WordPress installation, 20, 22, 23
while loop, 80
Xbox Live Gamer Card, 295