Muutke küpsiste eelistusi

ASP.NET Core Razor Pages in Action [Pehme köide]

  • Formaat: Paperback / softback, 456 pages, kõrgus x laius x paksus: 235x187x25 mm, kaal: 808 g
  • Ilmumisaeg: 21-Dec-2022
  • Kirjastus: Manning Publications
  • ISBN-10: 1617299987
  • ISBN-13: 9781617299988
  • Formaat: Paperback / softback, 456 pages, kõrgus x laius x paksus: 235x187x25 mm, kaal: 808 g
  • Ilmumisaeg: 21-Dec-2022
  • Kirjastus: Manning Publications
  • ISBN-10: 1617299987
  • ISBN-13: 9781617299988
Razor Pages lets you build, configure, and deploy amazing dynamic ASP.NET websites with ease.

In  ASP.NET Core Razor Pages in Action you will learn:





Building, configuring, and publishing a data-driven website Creating a complete web application step-by-step Forms for collecting and processing user data Connecting to databases from a Razor Page Protecting areas of a Razor Page from unauthorized access with ASP.NET Identity Using Object Relational Mapping tools to work with data in Razor Pages applications Generating CRUD pages using scaffolding gestures Generating and sending email from your web application



ASP.NET Core Razor Pages in Action teaches you to develop dynamic websites using the powerful Razor Pages framework, .NET 6, and ASP.NET. Razor Pages generates HTML on the server, and is the perfect choice for eCommerce sites, intranet services, content management systems, and other apps that require reliability. In this book, you'll use Razor Pages to build a complete application for booking city breaks, learning to iterate amazing new features chapter-by-chapter. about the technology Razor Pages sits on top of .NET 6 as a key part of ASP.NET Core, and has become the recommended tool for any developer building websites with Microsoft technologies. The page-focused framework is great for building dynamic websites that change frequently, and simplifies the process of building complex applications. about the book ASP.NET Core Razor Pages in Action shows you how to use Razor Pages to create dynamic websites that are easy to test and scale. You'll go hands-on to build a complete vacation-booking application, incorporating new framework features and adding complexities as they're introduced. As the application unfolds, you'll see how Razor Pages simplifies all the essential tasks of web development, from form creation and data processing, to easy publication and deployment. You'll also learn to enhance your web applications with the huge ecosystem of C# libraries, and how to locate the perfect tool for your task using centralized repositories.

Arvustused

'If you need to develop LoB applications, particularly CRUD apps, this book will give you the tools.' Paul Brown 'A great resource to learn Razor Pages.' Lee Cottrell 'A high degree of clarity, with excellent diagrams and code examples.' Mike Baran

Preface ix
Acknowledgments xi
About this book xii
About the author xv
About the cover illustration xvi
1 Getting started with Razor Pages
1(16)
1.1 What is Razor Pages?
2(4)
Web development frameworks
2(2)
Server-side frameworks
4(1)
Cross-platform functionality
5(1)
Open source
5(1)
Using your existing knowledge
6(1)
1.2 What can you do with Razor Pages?
6(1)
1.3 The technologies that underpin Razor Pages
6(4)
The ASP.NET Core MVC framework
7(1)
Model-view-controller
7(2)
The design goals of Razor Pages
9(1)
1.4 When should you use Razor Pages?
10(1)
1.5 Working with Razor Pages
11(6)
How do you get Razor Pages?
11(1)
Choosing a development environment
12(2)
Choosing a database system
14(3)
2 Building your first application
17(33)
2.1 Creating your first website
18(9)
Creating a website using Visual Studio
19(1)
Creating a website using the command-line interface
20(1)
Running the application
21(2)
Adding a new page
23(2)
Modifying to include dynamic content
25(2)
Adding the page to the navigation
27(1)
2.2 Exploring the project files
27(8)
The Web Application1.sin file
28(1)
The Web Application1.csproj file
28(1)
The bin and obj folders
29(1)
The Properties folder
29(1)
The wwwrootfolder
30(1)
The Pages folder
30(1)
The app-settings files
31(1)
Program.cs
32(3)
2.3 Understanding middleware
35(15)
An HTTP refresher
35(3)
The HttpContext
38(1)
The application request pipeline
39(2)
Creating middleware
41(4)
Middleware classes
45(5)
3 Working with Razor Pages
50(36)
3.1 Working with Razor syntax
51(11)
Directives and code blocks
51(3)
Rendering HTML with expressions
54(1)
Control blocks in Razor
55(2)
Rendering literal strings
57(1)
Rendering literal HTML
57(5)
3.2 Layout pages
62(6)
Assigning the Layout property
64(2)
Injecting optional content with sections
66(2)
3.3 Reusable HTML with partial views, tag helpers, and view components
68(4)
Partial views
68(2)
Tag helpers
70(2)
View components
72(1)
3.4 The PageModel
72(14)
Passing data to pages
73(2)
The PageModel as a view model
75(3)
The PageModel as a controller
78(8)
4 Matching URLs to Razor Pages with routing
86(29)
4.1 Routing basics
87(4)
Route templates
89(2)
4.2 Customizing route templates
91(13)
Overriding routes
91(1)
Route parameters
92(2)
Binding route data to handler parameters
94(2)
Catchall parameters
96(1)
Route constraints
96(4)
Creating additional routes
100(1)
Working with PageRouteModel conventions directly
101(3)
4.3 Generating URLs
104(11)
The anchor tag helper
104(3)
Using the IUrlHelper to generate URLs
107(1)
Generating redirect URLs from ActionResults
108(1)
Customizing URL generation
109(1)
Using parameter transformers to customize route and parameter value generation
110(5)
5 Working with forms: Model binding
115(37)
5.1 Forms basics
117(7)
Using the post-redirect-get pattern
117(2)
Accessing values from Request.Form
119(2)
Accessing values from Request Query
121(3)
5.2 Model binding
124(16)
Using model binding with handler parameters
124(1)
Using model binding with public properties
125(2)
Binding complex objects
127(5)
Binding simple collections
132(2)
Binding complex collections
134(6)
5.3 Validating user input in Razor Pages
140(12)
DataAnnotation attributes
140(2)
Client-side validation
142(4)
Server-side validation
146(1)
Managing more complex validation with ModelState
147(1)
Custom validation attributes
148(4)
6 Working with forms: Tag helpers
152(35)
6.1 The form and form action tag helpers
153(1)
6.2 Input and label tag helpers
154(10)
Understanding the input types
156(4)
Using data annotation attributes to control presentation
160(1)
Formatting the rendered date or time value
161(2)
Using the Display Attribute to control labels
163(1)
6.3 The select tag helper
164(14)
Creating options
165(5)
Binding multiple values
170(3)
Working with OptGroups
173(2)
Binding enumerations
175(3)
6.4 Check boxes and radio controls
178(1)
6.5 Uploading files
179(8)
7 Using dependency injection to manage services
187(23)
7.1 The reason for dependency injection
188(7)
Single-responsibility principle
188(4)
Loose coupling
192(1)
Dependency inversion
193(2)
Dependency injection
195(1)
7.2 Inversion of control containers
195(10)
Service registration
196(1)
Service lifetimes
197(4)
Captive dependencies
201(1)
Other service registration options
202(1)
Registering multiple implementations
203(2)
7.3 Other ways to access registered services
205(5)
View injection
205(1)
Method injection
206(1)
Directly from the service container with GetService and GetRequiredService
206(3)
Working with data
209(1)
8 What is Entity Framework Core?
210(42)
Why choose EF Core?
210(1)
How does EF Core work?
211(2)
Managing relationships
213(2)
Installing Entity Framework Core
215(1)
Create the context
216(1)
Adding DbSets
217(1)
Configuring the model
218(1)
8.2 Migrations
219(5)
Seed data
220(2)
Adding migration tools
222(1)
Creating and applying a migration
222(2)
8.3 Querying data
224(7)
Retrieving multiple records
224(3)
Selecting single records
227(4)
8.4 Scaffolding CRUD pages
231(7)
Visual Studio scaffold instructions
232(1)
Scaffolding from the command line
233(2)
Working with the scaffolded pages
235(3)
8.5 Creating, modifying, and deleting data
238(14)
Modifying data
241(4)
Deleting data
245(7)
9 Managing users with authentication
252(31)
9.1 Authentication basics
253(6)
How authentication works
253(1)
Adding simple authentication
254(5)
9.2 ASP.NET Core Identity
259(6)
Creating a user
260(1)
Configuring the DbContext
261(1)
Adding migration
262(3)
9.3 Customizing Identity
265(18)
Customizing Identity options
265(3)
Customizing the user
268(1)
Scaffolding and customizing the UI
269(8)
Enabling email confirmation
277(4)
Disabling UI features
281(2)
10 Controlling access with authorization
283(34)
10.1 Basic authorization in Razor Pages
284(6)
Applying simple authorization
285(5)
Allowing anonymous access
290(1)
10.2 Working with roles
290(7)
Viewing roles
291(1)
Adding roles
292(2)
Assigning roles to users
294(2)
Using policies to apply role checks
296(1)
10.3 Claims-based authorization
297(12)
Adding claims to users
298(4)
Using policies to enforce claims-based authorization
302(1)
Using assertions for more complex requirements
303(1)
Custom authorization requirements and handlers
304(4)
Roles or claims?
308(1)
10.4 Authorizing resources
309(8)
Creating a requirement and a handler
310(4)
Applying authorization to the UI
314(3)
11 Client-side technologies and AJAX
317(24)
11.1 Choosing your client-side technology
318(1)
11.2 Calling page handlers from JavaScript
319(12)
Using a partial page to return HTML
319(5)
Posting to a page handler
324(4)
Working with JsonResult
328(3)
11.3 Minimal request-handling APIs
331(6)
An example minimal API
332(1)
Parameters in minimal APIs
333(2)
Minimal API return types
335(2)
11.4 CSS Isolation in Razor Pages
337(4)
12 Troubleshooting your application
341(28)
12.1 Exception management
343(4)
The Developer Exception page
343(2)
ExceptionHandlerMiddleware
345(2)
12.2 StatusCodePages
347(6)
Exploring WithRedirects
348(2)
StatusCodePages WithReExecute
350(3)
12.3 Logging
353(16)
Logging basics
353(1)
Log levels
354(2)
Log categories
356(1)
Using EventIds
357(1)
Formatting the log message
358(1)
Applying log filter rules
358(2)
Custom email logger
360(3)
Structured logging with Serilog
363(6)
13 Protecting your application against external attacks
369(22)
13.1 HTTPS
370(5)
SSL/TLS certificates
371(1)
Using HTTPS in development
372(2)
Including HSTS in production
374(1)
13.2 Broken access control
375(4)
Incorrect security policies
375(1)
Cross-site request forgery
376(3)
13.3 Cryptographic failures
379(5)
Plain-text passwords
379(2)
Using the PasswordHasher without Identity UI
381(3)
13.4 Injection attacks
384(7)
SQL injection
384(3)
Cross-site scripting
387(4)
14 Configuring and publishing your application
391(30)
14.1 Working with environments
392(6)
Understanding and managing environments
392(1)
Setting the environment
393(2)
Registering services conditionally for each environment
395(1)
The IHostEnvironment service
396(1)
The environment tag helper
397(1)
14.2 Application configuration
398(7)
Appsettings.json
399(1)
Accessing configuration settings programmatically by key
400(1)
Strongly typed app settings
401(2)
Using the options pattern
403(1)
Binding directly to POCOs
403(1)
Environments
404(1)
14.3 Improving performance with caching
405(7)
The cache tag helper
406(3)
In-memory caching with IMemoryCache
409(3)
14.4 Publishing your application
412(9)
Self-contained and framework-dependent
412(1)
Publishing using the CLI
413(1)
Publishing using Visual Studio
414(7)
Index 421
Mike Brind  is an 11-time recipient of the Microsoft Most Valuable Professional (MVP) award for ASP.NET. He is a regular Razor Pages blogger and a moderator of the official ASP.NET forums.