index

Symbols

.csproj file 418

.NET DateTime object 96

@inject directive 205, 327

@model directive 70, 7374, 7677, 407

@page directive 68, 84, 9091, 100, 243

@section directive 66

@tagHelperPrefix directive 72

A

accept attribute 183

access control, with authorization 316

basic 284290

claims-based authorization 297309

introduction to 284

resources 309315

roles 290297

AccessDeniedPath option 288

action attribute 153154

ActionResult class 8384, 108109

Add method 238, 240

add-migration command 262

AddAuthentication method 254

AddAuthorization method 284, 296

AddClaimAsync method 273, 301

AddClaimsAsync method 309

AddedIdentity migration 262

AddModelError method 147148

AddPageRoute method 100103, 105, 110

AddPolicy method 296

AddRazorPages method 188, 196, 205

AddRoles method 291

AddRoles<TRole> method 291

AddScoped method 200

AddSingleton method 197198

addTagHelper directive 53, 71

AddToRoleAsync method 273

AddTransient method 197, 199

Admin role 294, 296297, 307308, 311, 314315

AdminPageModel class 288

AdminPolicy policy 297

AJAX (Asynchronous HTTP requests)

calling page handlers from JavaScript

posting to page handler 324328

using partial page to return HTML 319324

working with JsonResult 328331

choosing client-side technologies 318319

all-route-data parameter 106

AllowAnonymousToPage method 290

AllowedForNewUsers LockoutOptions properties 268

AllowedHosts property 399

AllowedHosts well-known configuration setting 399

AllowedUserNameCharacters property 266

allowedValues) method 302

alpha constraint 97

anchor tag helper 104107

anonymous 253

anonymous access, allowing 290

antiforgery custom attribute 154

Antiforgery options 377379

AntiforgeryOptions class 377

AntiForgeryToken method 327

Any extension method 133

app_offline files 416417

AppendTrailingSlash property 110

application configuration 419

accessing settings programmatically by key 400401

appSettings.json file 399400

custom settings 399400

strongly typed 401402

binding directly to POCOs 403404

caching 405412

cache tag helper 406409

in-memory caching with IMemoryCache 409412

environments 392398, 404405

environment tag helper 397398

IHostEnvironment service 396397

registering services conditionally for each 395396

setting 393395

understanding and managing 392393

options pattern 403

application development 49

middleware 3548

application request pipeline 3940

classes 4548

creating 4145

HTTP 3537

HttpContext 3839

project files 2735

AppSettings files 3132

bin and obj folders 29

Pages folder 3031

Program.cs file 3235

Properties folder 2930

WebApplication1.csproj file 2829

WebApplication1.sln file 28

wwwroot folder 30

website creation 1827

adding new pages 2325

adding pages to navigation 27

modifying to include dynamic content 2526

running applications 2122

using CLI 2021

using Visual Studio 1920

application logging 353

application publishing 412418

self-contained and framework dependent 412413

using CLI 413414

using Visual Studio 414418

enabling stdout logging 417418

fixing SDK version used for publishing 418

locked assemblies and app_offline files 416417

published output 415416

suppressing language folders 417

application request pipeline 3940

application security 390

broken access control 375379

cross-site request forgery 376379

incorrect security policies 375376

cryptographic failures 379384

plain-text passwords 379381

using PasswordHasher without Identity UI 381384

HTTPS 370375

including HSTS header in production 374375

SSL/TLS certificates 371372

using in development 372374

injection attacks 384389

cross-site scripting 387389

SQL injection 384387

application troubleshooting 368

exception management 343347

developer exception page 343345

ExceptionHandler middleware 345347

logging 353367

applying log filter rules 358359

custom email logger 360363

EventIds 357358

formatting log messages 358

introduction to 353354

log categories 356357

log levels 354356

structured logging with Serilog 363367

StatusCodePages middleware 347353

WithRedirects method 348350

WithReExecute method 350353

applicationUrl node 393

Apply method 102103, 111

ApplyConfiguration method 222

ApplyFormatInEditMode property 162

AppSettings files 3132

appSettings.json file 399400

custom settings 399400

strongly typed 401402

area attribute 107

areas feature 107, 272

asp-area attribute 71, 272

asp-for attribute 388

asp-items attribute 176, 244

asp-page attribute 27, 71

asp-route-* attribute 79

asp-route-id attribute 79

ASP.NET Core Identity 259265

adding migration 262265

configuring DbContext 261262

creating users 260

customizing 265282

customizing options 265268

customizing users 268269

disabling UI 281282

enabling email confirmation 277281

scaffolding and customizing UI 269276

using PasswordHasher without UI 381384

ASP.NET Core in Action (Lock) 35, 71

ASP.NET Core MVC framework 7

ASP.NET Core Security (Wenz) 389

ASPNETCORE_ENVIRONMENT variable 392

AspNetRoleClaims table 309

AspNetUser table 269

AspNetUserClaims table 262, 299

AspNetUserLogins table 262

AspNetUsers table 262, 264265, 267, 269, 276

AspNetUserTokens table 262

assertions 303304

AssignModel class 296

AssignModel code 294

AssignModel constructor 300

attribute 406

AttributeRouteModel property 102

-au switch 259

- -auth switch 259

authentication 282

adding simple 254259

ASP.NET Core Identity 259265

adding migration 262265

configuring DbContext 261262

creating users 260

customizing 265282

function of 254

introduction to 253259

authorization 316

basic 284290

allowing anonymous access 290

applying simple authorization 285289

claims-based authorization 297309

adding claims to users 298301

custom requirements and handlers 304308

roles vs. claims 308309

using assertions for complex requirements 303304

using policies to enforce 302303

introduction to 284

resources 309315

applying authorization to UI 314315

creating requirement and handler 310314

roles 290297

adding 292294

assigning to users 294296

using policies to apply role checks 296297

viewing 291292

authorization handlers 302

AuthorizationHandler<TRequirement> class 307

AuthorizationHandlerContext class 305

AuthorizationHandlerContext object 304

AuthorizationPolicyBuilder.RequireRole method 302

AuthorizationResult object 312

Authorize attribute 286, 288289, 296, 315, 336, 376

AuthorizeAreaFolder method 289

AuthorizeAsync method 314

AuthorizeFolder method 289290, 296297

AuthorizePage method 289

AuthorizeUserAsync method 312313

B

BCL (base class library) 6

BeginScope method 360

bin folder 29

BindProperties attribute 126127

BindProperty attribute 125127, 129, 131, 154, 161, 165, 236, 324, 382, 388

Blazor in Action (Sainty) 4

Body property 38

Book class 14

Booking class 333334

BookingInputModel parameter 333

bool .NET 156

bool constraint 97

Boolean multiple attribute 171

Boolean Succeeded property 312

Bootstrap img-fluid CSS class 185

bootstrapping 3233

broken access control 375379

cross-site request forgery 376379

incorrect security policies 375376

brute force attacks 260

build dotnet command 418

Build method 34

builder.Build method cal 331

C

-c, - -configuration <CONFIGURATION> option 413

CA (certificate authority) 371

<cache> tag 406

cache tag helper 406409

caching 405412

cache tag helper 406409

in-memory caching with IMemoryCache 409412

Calculate method 334

captive dependencies 201202

catch-all parameters 96

Challenge helper method 258

checkboxes 178179

Claim class 297

claims 256, 284, 297

claims-based authentication 256

claims-based authorization 297309

adding claims to users 298301

custom requirements and handlers 304308

creating separate handler class 305307

using multiple handlers for requirement 307308

roles vs. claims 308309

using assertions for complex requirements 303304

using policies to enforce 302303

ClaimsPrincipal type 254

ClaimTypes class 298

ClaimTypes.Email claim 298

ClaimTypes.GivenName claim 298

ClaimTypes.Name claim 298

ClaimTypes.NameIdentifier claim 298

ClaimTypes.Surname claim 298

CLI (Command Line Interface)

application publishing 413414

scaffolding CRUD pages 233234

website creation 2021

client-side technologies

calling page handlers from JavaScript 319331

posting to page handler 324328

using partial page to return HTML 319324

working with JsonResult 328331

choosing 318319

CSS isolation 337340

minimal request handling APIs 331337

example of 332333

parameters in 333335

return types 335337

route handler authorization 336337

client-side validation 142146

code blocks 5154

code first 212

collections

binding complex collections 134140

explicit index approach 136140

sequential index approach 134136

binding simple collections 132133

comments 6162

Compare attribute 141

CompareFirstLetterAttribute C# class 149

Configuration property 33

Configure method 218, 220

Configure<TService> method 403

ConfigureServices method 101

Connection property 38

ConnectionStrings property 216

ConnectionStrings section 217

Console built-in provider 353

Console provider 359

Console section 359

ConstraintMap collection 100

ConstraintMap property 113

container CSS class 338

containers 187

Contains string method 388

content page file 31

ContentLength property 3839

ContentRootPath property 396

contentType options 330

ContentType property 3839

context 210, 216

control blocks 5556

control container inversion 195205

captive dependencies 201202

registering multiple implementations 203205

service lifetimes 197201

scoped services 200201

singleton services 197199

transient services 199200

service registration 196, 202

conventions 45

Cookie option 377

Cookies property 3839

count property 366

Count() method 226

Countries collection 136

Country class 130, 136, 174, 213

Country entity 213

Country property 174, 213

CountryCode input 144

CountryCode property 127, 219

CountryConfiguration class 220

CountryId country class 214

CountryId foreign key 213

CountryName property 127, 150

Create class 223

Create option 234

Create Property 171

Create template 232

CreateAsync CRUD method 291

CreateAsync method 240, 273, 292, 411

CreateBuilder method 32, 364

CreateEntry method 409

CreateLogger method 356, 362

CreateModel class 128, 165, 168, 182, 189, 192, 195, 388

CreateUser method 275

CreatorId property 310311

Credentials properties 404

Critical log level 355

cross-platform functionality 5

cross-site request 376

cross-site scripting (XSS) 387389

CRUD pages, scaffolding 231237

CLI 233234

Visual Studio 232233

working with scaffolded pages 235237

cryptographic failures 379384

plain-text passwords 379381

using PasswordHasher without Identity UI 381384

CSRF (cross-site request forgery) 376379

CSS isolation 337340

culture 101

culture parameter 102

current properties 236

cursor:pointer rule 337

D

data annotation attributes 160161

DataTypeAttribute attribute 160161

DisplayAttribute attribute 163164

data attributes 321

data integrity 370

data-id attribute 321

data-val attribute 144145, 159

data-val-* attributes 142

data-val-required attribute 159

DataAnnotation class 140142

- -dataContext | -dc option 233

DataFormatString property 162

DataGroupField name 175

DataReader container 210

DataTable container 210

DataType attribute 160161

DataType enumerations 161

DataTypeAttribute attribute 160161

Date Data Type enumeration 160

DateTime 156

datetime constraint 97

DateTime PageModel property 161

DateTime property 161, 247

DateTime type 74

datetime type 97, 213

datetime value 37

datetime-local control 162

datetime-local input type 156, 161

DayRate property 328

DbContext Add method 246

DbContext class

configuring 261262

configuring services 261262

DbContext OnModelCreating method 218

DbContext operations 240

DbContext.Add method 240

DbContext.Remove method 246247

DbContext.Update method 240

DbContextOptions object 216

DbSet objects 224

DbSet properties 219, 261

DbSet property 217

DbSet type parameter 218

DbSet.Remove method 246

DbSet<TEntity> properties 217

DbSets 217

Debug built-in provider 353

Debug level 359

Debug log level 355

debug mode 414

decimal constraint 97

decimal, double, float 156

default scheme 254

DefaultLockoutTimeSpan LockoutOptions properties 268

Delete class 235

Delete column 247

Delete operation 311

Delete option 234

Delete template 232

DeleteAsync CRUD method 291

DeleteAsync method 273

Deleted column 248

Deleted property 247249

DeleteModel class 245

denial of service (DOS) attacks 180

Description attribute 177

Description property 388389

destructuring operator 366

DetailErrors configuration entry 32

Details class 235

Details option 234

Details template 232

developer exception page 343345

DeveloperExceptionPage middleware 353

Development environment 404

DI (dependency injection) 195208

control container inversion 195205

captive dependencies 201202

registering multiple implementations 203205

service lifetimes 197201

service registration 196, 202

GetService and GetRequiredService 206208

method injection 206

reasons for 188195

dependency injection 195

dependency inversion 193195

loose coupling 192

single responsibility principle 188192

view injection 205206

DIP (dependency inversion principle) 193195

directives 5154

disabling UI 281282

Display names 177

DisplayAttribute attribute 160, 163164

DisplayFormat attribute 162

Dispose method 362

div element 145, 274, 338

DOS (denial of service) attacks 180

dotnet add command 215

dotnet command 20

dotnet dev-certs https - -trust self-signed certificate 22

dotnet ef migrations remove (CLI) command 223

dotnet new sln command 28

dotnet new webapp command 372

dotnet publish command 412, 414

dotnet restore command 21, 215

dotnet run command 373, 393, 412

dotnet sln add command 28

dotnet tool 20

dotnet-aspnet-codegenerator tool 233

dotnet-ef tool 222, 233

double constraint 97

double submit cookies 376

Down method 223

DRY (don’t repeat yourself) 63

DV (domain validation) certificate 371

dynamic content, modifying pages to include 2526

dynamic input parameter 60

dynamic parameter 60

dynamic types 59

E

Edit authorization check 312

Edit class 235

Edit operation 311

Edit option 234

Edit requirement 311312

Edit template 232

EditModel class 241

EditModel code 235

EF Core (Entity Framework Core) 14251

adding DbSets 217

configuring model 218219

creating context 216217

creating data 238241

deleting data 245251

function of 211212

installing 215

managing relationships 213215

migrations 219224

adding migration tools 222

creating and applying 222224

seed data 220222

modifying data 241245

querying data 224231

retrieving multiple records 224227

selecting single records 227231

reasons for 210211

scaffolding CRUD pages 231237

CLI 233234

Visual Studio 232233

working with scaffolded pages 235237

EF.Functions.Collate method 230

else keywords 55

email confirmation, enabling 277281

Email property 260, 276

EmailAddress Data Type enumeration 160

EmailAddress standalone attribute 161

EmailSender interface 392

Empty option 234

empty template 232

encryption 370

enctype attribute 179, 183

Endpoint middleware 8889

EndpointRouting middleware 8789

endpoints 35, 86, 284

Entity Framework Core in Action (Smith) 210, 250

Entity Framework Core. See EF Core

<entity_name>Id property 214

EntityFramework category 364

EntityState.Modified state 240

Environment property 3334, 396

environment tag helper 397398

environments 392398, 404405

environment tag helper 397398

IHostEnvironment service 396397

registering services conditionally for each 395396

setting 393395

understanding and managing 392393

environmentVariables section 393

Error log level 355

ErrorMessage property 145

EV (extended validation) 371

EventIds 357358

EventLog built-in provider 353

EventSource built-in provider 353

exception management 343347

developer exception page 343345

ExceptionHandler middleware 345347

ExceptionHandler middleware 345347

exclude attribute 398

ExecuteAsync method 344345

execution phase 225

expires-after attribute 409

expires-on attribute 409

expires-sliding attribute 409

explicit dependencies principle 192

explicit expression 55

explicit indexes 136140

extension methods 224

Extensions class 46

F

-f, - -framework <FRAMEWORK> option 413

fade class 320

Fail method 305

Fatal highest log level 365

FileContentResult ActionResult class 83

FindAsync method 239240

FindByIdAsync method 273, 301, 309

FindByNameAsync method 273

FirstAsync method 228

FirstOrDefaultAsync method 228

float constraint 98

for attribute 70, 155, 158, 165, 169 – 170

- -force | -f option 234

form action tag helper 153154

form element 117, 153

Form property 38, 120

form tag helper 153154

formaction attribute 153

format attribute 162

FormFieldName option 378

forms 117123

accessing values from Request.Form collection 119121

accessing values from Request.Query collection 121123

model binding

binding complex collections 134140

binding complex objects 127131

binding simple collections 132133

user input validation 140150

using with handler parameters 124

using with public properties 125126

post-redirect-get pattern 117119

tag helpers 186

checkboxes and radio controls 178179

form and form action tag helpers 153154

input and label tag helpers 154164

select tag helper 164177

uploading files 179185

framework-dependent application 412

From* attributes 333, 335

FromBody attribute 328, 331

FromServices attribute 206

FromSqlRaw method 386

Func<dynamic, object> generic delegates 59

functions block 54

functions directive 54

G

Get<TItem> method 410

GetAllAsync method 191, 225, 249

GetAndStoreTokens method 327

GetByNameAsync method 227, 231

GetCityOptions method 171, 173174, 189, 191

GetEndpoint method 88

GetOrCreate<TItem> method 410

GetRequiredService method 206208

GetService method 206208

GetUserAsync method 273

guid constraint 98

H

h5 elements 321, 337338

HandleAsync method 304

handler methods

binding route data to parameters 9496

named 8082

parameters 7980

return types 8284

using model binding with handler parameters 124

“handler” parameter 106

HandleRequirementAsync method 307

handlerSettings section 417

HasClaimHandler class 307

HasColumnName method 219, 221

HasData method 220

HasFormContentType property 123

HashedPassword property 260

hashing 379

HasMaxLength method 219

HasStarted property 39

header element 69

HeaderName option 378

Headers property 3839

help (- -help or -h) option 413

HiddenInput standalone attribute 161

host attribute 107

Host property 400

hot reload 23

href attribute 27, 71, 79, 104105, 154

HSTS header, including in production 374375

HTML

rendering literal 5762

comments 6162

templated delegates 5961

rendering with expressions 5455

reusable 6872

partial views 6870

tag helpers 7072

view components 72

using partial page to return 319324

Html helper property 327

Html.Antiforgery helper 377

Html.AntiForgeryToken method 327

Html.GetEnumSelectList method 176, 178

Html.Raw method 58, 388

HTTP (Hypertext Transfer Protocol) 3537

HTTP HSTS (Strict-Transport-Security) header 374

HttpContext class 3839

HttpContext parameter 45

HttpContext property 120

HttpRequest class 38

HttpResponse class 39

HTTPS (Hypertext Transfer Protocol Secure) 370375

including HSTS header in production 374375

SSL/TLS certificates 371372

using in development 372374

I

I/O (out of process) calls 236

IActionResult interface 82

IAntiforgery service 327, 376

IApplicationBuilder 34

IAuthorizationHandler interface 304

IAuthorizationRequirement interface 304

IBooking interface 334

ICityService interface 193, 195, 224, 228, 410

IConfiguration Bind method 403

IConfiguration service 399400

IConfiguration.Get<T> method 402

id attribute 155, 179, 320

Id integer property 136

id parameter 79, 321, 386

Id property 214

id property 120

identities 253, 256

Identity property 257

Identity UI IEmailSender interface 395

IdentityDbContext class 262

IdentityOptions class 265

IdentityOptions properties 265

IdentityRole object 309

IdentityUser 260

IDEs (integrated development environments) 13

IEmailSender interface 277, 396

IEndpointRouteBuilder 34

IEntityTypeConfiguration class 221

IEnumerable type 224

If-Modified-Since header 37

IFormFile interface 180

IgnoreAntiforgeryToken attribute 327, 378

IgnoreSection method 6768

IHost 34

IHostEnvironment service 396397

IHtmlLocalizer service 205

IIS (Internet Information Services) 33, 392

ILogger interface 354, 360

ILoggerProvider interface 362

IMemoryCache extension methods 409

IMemoryCache service 409412

IMiddleware interface 4748, 196

IMiddlewareFactory interface 48

implicit dependency 192

implicit expressions 55

ImplicitUsings property 28

include attribute 398

Include method 225, 235, 239

Index PageModel class 235

IndexModel class 249, 397

IndexModel home page 257, 362

IndexModel OnGet method 263

IndexOf string method 388

Information log level 355

inject directive 53, 314

injection attacks 384389

cross-site scripting 387389

SQL injection 384387

input model 127

input tag helper 154164

data annotation attributes for controlling presentation 160161

DataTypeAttribute attribute 160161

DisplayAttribute attribute 163164

formatting rendered date or time value 161162

input types 156160

input validation 140

InputModel class 129, 131, 134, 274

INSERT statement 240

install-package command 215

int constraint 97

integrated development environments (IDEs) 13

Internet Information Services (IIS) 33, 392

Invoke method 45, 48, 406

Invoke/InvokeAsync method 48

InvokeAsync method 48, 206

IoC (inversion of control) 193

IOptions<TOptions> interface 403

IOutboundParameterTransformer interface 110

IpAddressMiddleware class 45

IPageConvention interface 102

IPageRouteModelConvention interface 101102, 111

IPasswordHasher interface 381

IPriceService interface 203205

IPropertyService interface 238, 248

IResult options 336

IRouteConstraint interface 99100

IRouteConstraint method 100

IsAuthenticated property 257

IsDevelopment extension method 397

IsEnabled method 360

IServiceProvider GetService method 202

IServiceProvider service 207

IsHttps property 38

IsInRole method 309

IsInRoleHandler class 308

IsProduction method 396

IsSectionDefined method 67

IsStaging method 396

Issuer property 297

IStatusCodeReExecuteFeature feature 352

IsValid method 149

IsValid property 146

item parameter 59

ItemGroup node 215

items attribute 165

IUrlHelper service 107108

IUserConfirmation<TUser> interface 267

IUserEmailStore.SetEmailAsync method 275

IUserPhoneNumberStore interface 275

IUserStore.SetUserNameAsync method 275

IWebHostBuilder object 33

IWebHostEnvironment service 183, 396

IWebHostEnvironment.ContentRootPath property 416

J

JavaScript

calling page handlers from 319331

JsonResult constructor 328331

posting to page handler 324328

using partial page to return HTML 319324

json() method 329, 336

JsonResult constructor 328331

K

kebab case 110

L

label tag helper 154164

DisplayAttribute to control labels 163164

input types 156160

language folders, suppressing 417

- -layout | -l option 234

layout pages 6268

assigning Layout property 6466

injecting optional content with sections 6668

Layout property 6466

least privilege principle 375

length constraint 98

-lf option 271

LifetimeDemoModel class 199

LinkGenerator service 104

LINQ (Language Integrated Query) 211

list box control 132

List option 234

List template 232

List<IdentityRole> property 291

- -listFiles option 271

localization 101

Lock, Andrew 35, 71

locked assemblies 416417

Lockout property 265

LockoutEnabled property 260

LockoutOptions class 268

LockoutOptions properties 268

Log method 360361, 363

Log.Fatal method 365

Log.Logger method 364

Log* methods 358

logging 353367

applying log filter rules 358359

custom email logger 360363

enabling stdout logging 417418

EventIds 357358

formatting log messages 358

introduction to 353354

log categories 356357

log levels 354356

structured logging with Serilog 363367

Logging property 33

logging provider 353

Logging section 358359

LogInformation method 354

LoginPath cookie option 287

LogLevel property 359

LogLevel section 359

long constraint 98

loose coupling 192

LowercaseQueryStrings property 109

LowercaseUrls Boolean property 109

M

main element 338

Main method 32

man-in-the-middle attacks 375

MapPost method 332

MapRazorPages method 35, 88, 254

marker interface 102

Match method 100

max constraint 98

MaxFailedAccessAttempts LockoutOptions properties 268

MaxLength attribute 141

maxlength constraint 98

Membership framework 308

Message output 172

Message property 7879, 81, 123126, 169

metadata 116, 160

method attribute 78, 117, 326

method injection 206

Method property 38

Microsoft AspNetCore category 364

Microsoft.AspNetCore category 359

Microsoft.AspNetCore.Http namespace 180

Microsoft.AspNetCore.Identity package 381

Microsoft.AspNetCore.Identity.EntityFrameworkCore Nuget package 260

Microsoft.AspNetCore.Identity.EntityFrameworkCore package 381

Microsoft.AspNetCore.Identity.UI package 260

Microsoft.AspNetCore.Mvc namespace 161

Microsoft.AspNetCore.Mvc.Rendering namespace 166

Microsoft.EntityFrameworkCore.Design package 222

Microsoft.EntityFrameworkCore.SqlServer package 233

Microsoft.EntityFrameworkCore.Tools package 222

Microsoft.VisualStudio.Web.CodeGeneration.Design templates 232

middleware 3548

application request pipeline 3940

classes 4548

convention-based approach 4547

implementing IMiddleware interface 4748

creating 4145

HTTP 3537

HttpContext class 3839

middleware classes 4548

convention-based approach 4547

implementing IMiddleware interface 4748

migrations 219224

adding migration tools 222

creating and applying 222224

seed data 220222

min constraint 98

minimal request handling APIs 331337

example of 332333

parameters in 333335

return types 335337

route handler authorization 336337

MinLength attribute 141

minlength constraint 98

mixed content issues 373

- -model | -m option 233

model attribute 70

model binding 80, 116151

binding complex collections 134140

explicit index approach 136140

sequential index approach 134136

binding complex objects 127131

binding simple collections 132133

directly to POCOs 403404

enumerations 175177

forms 117123

accessing values from Request.Form collection 119121

accessing values from Request.Query collection 121123

post-redirect-get pattern 117119

multiple values 170172

user input validation 140150

client-side validation 142146

custom validation attributes 148150

DataAnnotation attributes 140142

managing complex validation with ModelState 147148

server-side validation 146147

using with handler parameters 124

using with public properties 125126

model directive 5253

Model property 77, 298

Model.City variable 343

ModelBuilder ApplyConfiguration method 222

ModelOnly option 145

ModelState dictionary 147

ModelState errors 145, 241, 389

ModelState object 147148

months parameter 305

multiple attribute 132, 170171

multiplicity 213

MVC (model-view-controller) pattern 78

MyDelegate delegate 41

myUnorderedListTemplate variable 59

N

-n (or - -name) option 24

-na (or - -namespace) option 24

name attribute 117, 119, 121, 126, 129, 131, 135, 154155

Name claim 298

name parameter 9293, 410

Name property 126, 163, 183, 257, 310, 385

NameIdentifier claim 298, 311

nameof operator 175, 411

names attribute 398

namespace directive 53

- -namespaceName | -namespace option 234

nav element 68, 256

navigational properties 213

nested class 129

new keyword 192

new operator 83

new page command 24

new PageResult() expression 83

NewLine property 365

- -noPageModel | -npm option 234

NotFound method 346347

NotFoundResult ActionResult class name 83

nullable annotations and warnings context 28

Nullable property 28

nullable reference types 28

number input type 156

nvarchar(max) datatypes 219

O

-o (or - -output) option 24

-o option 24

-o, - -output <OUTPUT_DIR> option 413

obj folder 29

object types 74

ObjectType property 150

On handler methods 81

OnGet handler 74, 78, 106, 118, 137, 166167, 206, 281

OnGet handler parameter (id) 241

OnGet method 7880, 168, 171

OnGetAsync handler 236, 241, 257, 312

OnGetAsync method 78, 80, 242, 281, 298, 300, 313, 315, 320, 343, 356357, 362, 365, 408, 411

OnGetPropertyDetails handler 366

OnModelCreating method 218, 222, 261

OnPost handler 78, 80, 106, 118, 123125, 131, 134, 147, 154, 167, 206, 255, 281

OnPost method 78, 80, 124, 130, 148, 168, 171, 383

OnPostAsync handler 78, 240242, 246, 256, 275, 281, 388

OnPostBooking page handler 333

OnPostRegister handler method 81

OnPostSearch handler 8183

OnPostSearch method 81

OperationAuthorizationRequirement class 310

opinionated framework 7

optgroup element 173

OptGroups 173175

options

configuring LockoutOptions 268

configuring password options 266267

configuring SignInOptions 267268

configuring user options 266, 268

creating 165170

OptGroups 173175

setting selected value 170

setting value of 167169

options pattern 402

OrderBy method 228

OriginalPath property 352

OriginalQueryString property 352

out of process (I/O) calls 236

outputTemplate parameter 365

OV (organization validation) 371

overposting attacks 127

OWASP (Open Web Application Security Project) 180, 370

P

Package Manager Console (PMC) 215

PackageReference entry 215

page attribute 105

page controller 51

page directive 5253

Page method 108

page-based routing 87

page-handler attribute 81, 106

Page() helper method 83

PageConventionCollection type 289

PageLink method 108

PageModel class 18, 27, 72, 107, 110111, 120, 124127, 129, 133134, 146, 189190, 235, 241, 255, 258, 285, 290, 292, 331, 378

as controller 7884

handler method parameters 7980

handler method return types 8284

named handler methods 8082

as view model 7578

passing data to pages 7375

PageModel constructor 204, 206, 355

PageRemote attribute 141142

PageResult class 83

PageRouteModel class 102

PageRouteModel conventions 101104

pages

adding new 2325

adding to navigation 27

calling page handlers from JavaScript 319331

posting to page handler 324328

using partial page to return HTML 319324

working with JsonResult 328331

CRUD pages 231237

developer exception page 343345

layout pages 6268

assigning Layout property 6466

injecting optional content with sections 6668

modifying to include dynamic content 2526

passing data to 7375

Pages folder 3031

parameter transformers

customizing route and parameter value generation 110114

transforming route parameter values 111114

partial views 6870

PartialResult class 83

- -partialView | -partial option 234

Password Data Type enumeration 160

Password property 265266, 275

PasswordHasher class 381384

PasswordHasherOptions class 380

PasswordOptions object 266

PasswordSignInAsync method 273

PasswordVerificationResult enum 383

Path class 52

Path property 39, 52

PendingRequirements property 306

PhoneNumber property 260

Photo property 183, 220221

plain-text passwords 379381

PMC (Package Manager Console) 215

POCOs (plain old CLR objects) 403404

Policy property 285, 303

POST method 37, 117119, 121, 123, 166, 179

POST request 78, 118119, 126, 167, 281, 326327, 332

preload directive 374

PRG (post-redirect-get) pattern 117119

Price property 127

primary key value 168

ProductionEmailService class 400, 402403

Program class 47, 88, 100, 109, 111, 196, 284, 289, 304, 353

Program.cs file 3235

project files 2735

AppSettings files 3132

bin and obj folders 29

Pages folder 3031

Program.cs file 3235

Properties folder 2930

WebApplication1.csproj file 2829

WebApplication1.sln file 28

wwwroot folder 30

- -project switch 22

promises 322

Properties folder 2930

Properties node 366

Property binding target 241

Property class 214, 232, 234236, 247, 309

Property entity 238

Property type 219, 222

PropertyAdmin role 294

PropertyAuthorizationhandler handler class 311

PropertyOperations class 310

PropertyService class 248

protocol attribute 107

public properties, using model binding with 125126

public property 298

public Value property 198

publish command 413

publish dotnet command 418

publish profiles 414

Q

Query property 39

querying data 224231

retrieving multiple records 224227

selecting single records 227231

QuerySelectorAll method 389

QuerySingleAsync method 386

R

-r, - -runtime <RUNTIME_IDENTIFIER> option 413

radio controls 178179

Range attribute 141

range constraint 9798

range input type 156

Rating property 178

Razor Pages 1685

application configuration 419

accessing configuration settings programmatically by key 400401

appSettings.json file 399402

binding directly to POCOs 403404

caching 405412

environments 392398, 404405

options pattern 403

application development 49

middleware 3548

project files 2735

website creation 1827

application publishing 412418

self-contained and framework dependent 412413

using CLI 413414

using Visual Studio 414418

application security 390

broken access control 375379

cryptographic failures 379384

HTTPS 370375

injection attacks 384389

application troubleshooting 368

exception management 343347

logging 353367

StatusCodePages middleware 347353

authentication 282

adding simple 254259

ASP.NET Core Identity 259282

function of 254

introduction to 253259

authorization 316

basic 284290

claims-based authorization 297309

introduction to 284

resources 309315

roles 290297

client-side technologies 340

calling page handlers from JavaScript 319331

choosing 318319

CSS isolation 337340

minimal request handling APIs 331337

database system 1416

dependency injection 208

control container inversion 195205

GetService and GetRequiredService 206208

method injection 206

reasons for 188195

view injection 205206

development environment 1214

downloading 1112

EF Core 251

adding DbSets 217

configuring model 218219

creating context 216217

creating data 238241

deleting data 245251

function of 211212

installing 215

managing relationships 213215

migrations 219224

modifying data 241245

querying data 224231

reasons for 210211

scaffolding CRUD pages 231237

introduction to 26

cross-platform functionality 5

languages 6

open source 56

server-side frameworks 45

web development frameworks 24

layout pages 6268

assigning Layout property 6466

injecting optional content with sections 6668

model binding 151

binding complex collections 134140

binding complex objects 127131

binding simple collections 132133

forms 117123

user input validation 140150

using with handler parameters 124

using with public properties 125126

PageModel class 7284

as controller 7884

as view model 7578

passing data to pages 7375

reusable HTML 6872

partial views 6870

tag helpers 7072

view components 72

routing 114

introduction to 8791

route templates 8991

URL generation 104114

syntax 5162

control blocks 5556

directives and code blocks 5154

rendering HTML with expressions 5455

rendering literal HTML 5762

rendering literal strings 57

tag helpers 186

checkboxes and radio controls 178179

form and form action tag helpers 153154

input and label tag helpers 154164

select tag helper 164177

uploading files 179185

technologies 610

ASP.NET Core MVC framework 7

design goals 910

MVC pattern 78

uses for 6, 1011

RazorPagesOptions Conventions collection 103

RazorPagesOptions Conventions property 101

RCL (Razor Class Library) 269

reason phrase 37

Recordset container 210

Redirect property 39

RedirectToPage method 108109, 281

RedirectToPagePermanent method 108109

RedirectToPageResult ActionResult class 84

reference navigation property 213

- -referenceScriptLibraries | -scripts option 234

regex constraint 98

Register handler 106

RegisterConfirmation page 279

RegisterModel class 274

Registration page, amending 274276

RegularExpression attribute 141

- -relativeFolderPath | -outDir option 234

Release default configuration 414

Remove method 238, 246, 409

remove-migration (PowerShell) command 223

RenderBody method 6364

RenderSectionAsync method 6667

Request object 119120, 123124

request pipeline 39

Request property 38, 120

request validation 387

request verification token 376

request-based authorization 284

Request.Form collection 119, 121, 152

Request.Query collection 121123

RequestDelegate type specification 42

RequestSizeLimit attribute 180

RequestToken property 327

RequestVerificationToken request header 327

RequireAssertion method 302303

RequireAuthenticatedUser method 302

RequireAuthorization method 336337

RequireClaim method 302

RequireClaim(string claimtype, IEmumerable<string> allowedValues) method 302

RequireClaim(string claimtype) method 302

RequireConfirmedAccount SignInOptions property 268

RequireConfirmedEmail SignInOptions property 268

RequireConfirmedPhoneNumber SignInOptions property 268

Required attribute 141, 143, 177, 183

RequireDigit PasswordOptions property 266

RequiredLength PasswordOptions property 266

RequiredUniqueChars PasswordOptions property 267

RequireLowercase PasswordOptions property 266

requirements 284, 302

RequireNonAlphanumeric PasswordOptions property 266

RequireRole method 296

RequireUniqueEmail property 266

RequireUppercase PasswordOptions property 267

RequireUserName method 302

resolving dependencies 196

resource-based authorization 284

Response property 3839

restore command 215

Results class 335

Results.Bytes method 336

Results.File method 336

Results.Json method 335

Results.Ok method 335

Results.Text method 335

Role property 285

RoleManager class 309

RoleManager service 291292

RoleManager.Roles property 309

RoleManager<TRole> service 291

roles 262, 290297

adding 292294

assigning to users 294296

claims vs. 308309

using policies to apply role checks 296297

viewing 291292

Roles property 291, 296

RolesAuthorizationRequirement type 302

rolling log file 363

rollingInterval parameter 364

route attribute 106

route constraints 96100, 236

custom 98100

route data 92

route handler 331

route parameters 92

route templates

customizing 91104

binding route data to handler parameters 9496

catch-all parameters 96

creating additional routes 100101

overriding routes 9192

PageRouteModel conventions 101104

route constraints 96100

route parameters 9294

introduction to 8991

route-* attribute 105106

RouteData object 92

RouteEndpoint 89

RouteOptions object 109110, 113

RouteValueDictionary object 92

RouteValues property 352

routing 24, 84114

introduction to 8791

route templates 8991

binding route data to handler parameters 9496

catch-all parameters 96

creating additional routes 100101

customizing 91104

overriding routes 9192

PageRouteModel conventions 101104

route constraints 96100

route parameters 9294

URL generation 104114

anchor tag helper 104107

customizing 109110

generating redirect URLs from ActionResult 108109

parameter transformers 110114

using IUrlHelper 107108

rules, log filter 358

run command 24

Run method 42

- -runtime (or -r) option 415

S

Sainty, Chris 4

SaleEnds property 77

salt 267

samesite attribute 376

SaveChangesAsync method 238, 240

SaveToPickupDirectory method 279

scaffolding

CRUD pages 231237

CLI 233234

Visual Studio 232233

working with scaffolded pages 235237

UI 269276

amending Registration page 274276

SignInManager class 273274

UserManager class 273274

scope identifier 338

scoped services 200201

sdk node 418

SDK version 418

sdk-version option 418

Search handler 106

sections, injecting optional content with 6668

Secure Sockets Layer (SSL) 371

select element 132, 178

select tag helper 164177

binding enumerations 175177

binding multiple values 170172

creating options 165170

setting selected value 170

setting value of options 167169

working with OptGroups 173175

Selected property 170

SelectedCities property 133, 171

SelectedCity property 165, 168169

SelectedUserId property 300

SelectList class 173

SelectList constructor 168, 170

SelectList object 165

SelectList property 241

SelectList type 166

SelectListItem objects 165

SelectorModel objects 102

Selectors collection 102

Selectors property 102

self-contained application 412

- -self-contained option 413

semantic logging 353, 358

SendEmailAsync method 277, 360, 399, 402

sequential indexes 134136

Serilog 363367

Server Management Studio (SSMS) 16

server-side frameworks 45

server-side validation 146147

service containers 33, 195

service lifetimes 197201

scoped services 200201

singleton services 197199

transient services 199200

service locator pattern 206

service registration 202, 205208

control container inversion 196

GetService and GetRequiredService for accessing 206208

method injection 206

registering multiple implementations 203205

view injection 205206

service type 196

ServiceDescriptor objects 196

services 187

Services property 3334, 188, 196

Session property 38

Set method 411

Set<TItem> method 410

shadow foreign key property 214

shared-style identifier 339

Sign in anchor tag helper 263

Sign out anchor tag helper 263

SignIn options 279

SignIn property 265

SignInAsync method 256, 258, 273

SignInManager class 273274

SignInManager identity actor 272

SignInOptions class 267268

SignInOptions properties 268

SignOutAsync method 273

SimpleCityService class 192194

Single method 239

single responsibility principle (SRP) 188192

single-page applications (SPAs) 4, 319

SingleAsync method 228

SingleOrDefaultAsync method 228

singleton services 197199

SingletonService class 201

sinks 363

slugs 112

Smith, Jon P. 210, 250

SmokingPermitted property 159

SmtpSettings class 402

SmtpSettings section 400403

SmtpSettings:Host key 400

soft delete 238, 247

span element 143

SPAs (single-page applications) 4, 319

specification phase 225

SpecifiedPickupDirectory delivery method 278

SQL DELETE statement 246

SQL injection 384387

SQL injection attacks 211

SQL UPDATE statement 240, 248

SRP (single responsibility principle) 188192

SSL (Secure Sockets Layer) 371

SSL/TLS certificates 371372

SSMS (Server Management Studio) 16

Startup class 32, 42

StatusCode property 39

StatusCodePages middleware 347

WithRedirects method 348350

WithReExecute method 350353

StatusCodeResult ActionResult class name 84

stdout logging 418

stop string parameter 44

string.Concat method 345

string.Split method 121

StringLength attribute 141, 143, 275

strings, rendering literal 57

StringValues object 119, 121

StringValues type 121

structured logging 342, 353, 358

stubs 246

Succeed method 305

SupportsGet parameter 131

SupportsGet property 126

SuppressXFrameOptionsHeader option 378

switch statement 56

syntax 5162

code blocks 5154

control blocks 5556

directives 5154

rendering HTML with expressions 5455

rendering literal HTML 5762

comments 6162

templated delegates 5961

rendering literal strings 57

System.ComponentModel.DataAnnotations namespace 140, 160

System.Net.Mail class 278

T

T parameter 356, 402

tag helpers 27, 70186

anchor tag helper 104107

cache tag helper 406409

checkboxes and radio controls 178179

enabling 7172

environment tag helper 397398

form and form action tag helpers 153154

input and label tag helpers 154164

data annotation attributes to control presentation 160161, 163164

formatting rendered date or time value 161162

input types 156160

select tag helper 164177

binding enumerations 175177

binding multiple values 170172

creating options 165170

working with OptGroups 173175

uploading files 179185

target variable 108

<TargetFramework> node 418

TargetFramework node 413

Task return type 8283

Task<TItem> GetOrCreateAsync method 410

td element 314

technical expertise 5

TempData attribute 147, 183

Template property 102

Template View 51

templated delegates 5961

templated Razor delegate feature 59

templates 358

terminal middleware 42

<text> tag 57

TEXT type 247

text-danger class 145

text() method 322, 329, 336

ThingsToDoWidget section 66

tight coupling 192

Time Data Type enumeration 160

TLS (Transport Layer Security) protocol 371

ToListAsync method 225

top-level statements 32

ToString() method 74

TotalCost property 329

Trace log level 355

tracking 240

TransformOutbound method 110

transient services 199200

TryAdd method 205

TryAdd<LIFETIME> method 205

TryGetValue method 409

TryGetValue<TItem> method 410411

type attribute 132, 153, 155156, 160161

Type property 297

U

UI

applying authorization to 314315

disabling 281282

scaffolding 269276

amending Registration page 274276

SignInManager class 273274

UserManager class 273274

ul element 27, 256

unsafe characters 57

unsafe HTTP methods 379

Up method 223, 262

Update method 238, 246, 248

UPDATE statement 248

update-database command 262

update-database migration 269

UpdateAsync CRUD method 291

UpdateAsync method 240, 243, 273, 411

Upload property 183

uploading files 179185

URI (uniform resource identifier) 37

URL (uniform resource locator) 37

Url Data Type enumeration 160

URL generation 104114

anchor tag helper 104107

customizing 109110

generating redirect URLs from ActionResult 108109

parameter transformers 110114

using IUrlHelper 107108

Url property 107108

Url standalone attribute 161

URLSearchParams interface 328

US FIPS (Federal Information Processing Standards) 380

Use method 44

- -useDefaultLayout | -udl option 234

UseExceptionHandler method 34, 345346

UseHttpsRedirection method 35

UseMiddleware method 46

UseMiddleware methods 47

User class 381

user input validation 140150

client-side validation 142146

custom validation attributes 148150

DataAnnotation attributes 140142

managing complex validation with ModelState 147148

server-side validation 146147

user management

authentication 282

adding simple 254259

ASP.NET Core Identity 259282

function of 254

introduction to 253259

User property 38, 254, 257258, 265266, 303

UserManager class 273274

UserManager identity actor 272

UserManager methods 273

UserManager.GetClaimsAsync method 299

UserName property 260, 267, 276

UserOptions class 266

UserOptions properties 266

UseRouting method 88

UseSerilog method call 364

- -useSqlite | -sqlite option 234

UseSqlite method 217

UseStatusCodePages extension method 347

UseStatusCodePagesWithRedirects method 348

UseStatusCodePagesWithReExecute method 348, 350

using directive 28, 42, 46, 5253, 166, 175, 182, 191, 217, 241, 257, 261, 296, 364

V

ValidateAntiForgeryToken attribute 378

validation-for attribute 143

validation-summary attribute 145

validation-summary-valid CSS class 146

ValidationNever attribute 145

ValidationResult object 149

ValidationScriptsPartial tag helper 146

value attribute 132, 155, 168

Value property 297, 403

<vc> tag 407

Verbose log level 365

VerifyHashedPassword method 384

view components 72, 406

view injection 205206

View method 406

view model 73

ViewBag property 75

ViewComponent 406

ViewData dictionary-based feature 73

ViewData entry 75

ViewData property 73

ViewModel class 76

viewmodel class 9

ViewRolesHandler class 306

Visual Studio

application publishing 414418

enabling stdout logging 417418

fixing SDK version used for publishing 418

locked assemblies and app_offline files 416417

published output 415416

suppressing language folders 417

scaffolding CRUD pages 232233

website creation 1920

void return type 8283

VS Code (Visual Studio Code) 13

W

Warning log level 355, 364

web development frameworks 24

WebApplication object 42

WebApplication property 396

WebApplication type 32, 34, 331, 396

WebApplication.CreateBuilder call 364

WebApplication.CreateBuilder method 353, 363, 394, 398

WebApplication1 namespace 46

WebApplication1.csproj file 2829

WebApplication1.sln file 28

WebApplicationBuilder Environment property 396

WebApplicationBuilder type 395396

WebApplicationOptions object 394

WebHost property 33

WebRootPath property 183

website creation 1827

adding new pages 2325

adding pages to navigation 27

modifying to include dynamic content 2526

running applications 2122

using CLI 2021

using Visual Studio 1920

week input type 156, 161

WelcomeModel class 78

WelcomeModel type 74, 77

WelcomeModel. PageModel classes 73

well-known configuration settings 399

Wenz, Christian 389

Where method 225

widgets 72

WithRazorPagesRoot extension method 90

WithRedirects method 348350

WithReExecute method 350353

work factor 380

WorkStatus enumeration 175

WriteAsync property 39

WriteTo method 364

WriteTo.Console method 365

wwwroot folder 30

X

XSS (cross-site scripting) 387389

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset