0%

Book Description

A beginner's guide to building fully functioning web applications from scratch using the latest features of ASP.NET Core 3 and C# 8

Key Features

  • Get to grips with the new features and APIs in ASP.NET Core 3, EF Core 3, and Blazor
  • Create web APIs that integrate your applications with other systems and services
  • Learn to deploy your web applications in new environments such as the cloud and Docker containers

Book Description

ASP.NET Core is an open source framework from Microsoft that makes it easy to build highly efficient and dynamic cross-platform web applications. Updated for the latest features of ASP.NET Core 3, this second edition will equip you with the skills you need to build powerful web applications.

The book starts with an introduction to ASP.NET Core and its features, giving you a complete understanding of the framework. You will also learn how to set up your development environment with Visual Studio 2019 and build a fully functioning application from scratch. You'll then understand core concepts for building web applications such as Model View Controller (MVC), dependency injection, and WebSockets. As you advance, you'll discover how to use Entity Framework Core 3 to automate all database-related activities for your application. You will then build and document secure web APIs using security best practices to protect your web applications from threats and vulnerabilities. Finally, you will learn how to use Azure DevOps as a CI/CD tool to deploy and monitor your applications using Microsoft Azure, Amazon Web Services (AWS), and Docker.

By the end of this book, you'll have the skills you need to develop efficient and robust web applications in ASP.NET Core 3.

What you will learn

  • Delve into basic and advanced ASP.NET Core 3 concepts with the help of examples
  • Build an MVC web application and use Entity Framework Core 3 to access data
  • Add web APIs to your web applications using RPC, REST, and HATEOAS
  • Create a fully automated continuous integration and continuous delivery (CI/CD) pipeline using Azure DevOps
  • Use Azure, Amazon Web Services, and Docker to deploy and monitor your applications
  • Secure your web application from common attacks such as Cross-Site Scripting and SQL injection
  • Explore client-side development using C# Razor components

Who this book is for

This book is for developers who want to build modern web applications with ASP.NET Core. The book will also be helpful for anyone working in infrastructure engineering and operations to monitor and diagnose problems during the runtime of ASP.NET Core 3.0 web applications. Although no prior understanding of ASP.NET or .NET Core is required, basic C# programming knowledge is assumed.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Learn ASP.NET Core 3 Second Edition
  3. Dedication
  4. About Packt
    1. Why subscribe?
  5. Contributors
    1. About the authors
    2. About the reviewer
    3. Packt is searching for authors like you
  6. Preface
    1. Once upon a time – NGWS and .NET Framework
    2. Who this book is for
    3. What this book covers
    4. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Code in Action
      4. Conventions used
    5. Get in touch
      1. Reviews
  7. Section 1: Introduction and Environment Setup
  8. What Is ASP.NET Core 3?
    1. The history of ASP.NET 
    2. ASP.NET Core 3 features
    3. What is new specifically to ASP.NET Core 3?
    4. Cross-platform support
    5. Microservice architecture
      1. Working with containers
    6. Performance and scalability
    7. Technology restrictions
      1. Common technologies not directly found in ASP.NET Core and .NET Core
    8. When to choose ASP.NET Core 3
    9. Summary
  9. Setting Up the Environment
    1. Visual Studio 2019 as a development environment
    2. How to install Visual Studio 2019 Community Edition
      1. First steps with Visual Studio 2019
      2. Creating your first ASP.NET Core 3 application in Visual Studio 2019
      3. Creating your first ASP.NET Core 3 application via the command line
    3. Basic debugging with Visual Studio 2019
      1. Breakpoints
      2. Call stack
      3. Autos, Locals, and Watch Panes
    4. Visual Studio Code as a development environment
    5. How to install Visual Studio Code on Linux
      1. Creating your first ASP.NET Core 3 application in Visual Studio Code
      2. Creating your first ASP.NET Core 3 application in Linux
    6. Introduction to the C# Interactive and LINQPad tools
    7. Summary
  10. Continuous Integration Pipeline in Azure DevOps
    1. Technical requirements
    2. CI, CD, and build and release pipelines
      1. Using Azure DevOps for CI and CD
      2. Creating a free Azure DevOps subscription and your first Azure DevOps project
    3. Organizing your work via work items
    4. Understanding the scrum process
    5. Using Git as a VCS
      1. Using feature branches
      2. Merging changes and resolving conflicts
    6. Creating an Azure DevOps build pipeline
    7. Creating an Azure DevOps release pipeline
    8. Summary
  11. Section 2: A Practical Demonstration of ASP.NET Core 3
  12. Basic Concepts of ASP.NET Core 3 via a Custom Application: Part 1
    1. Preview of the Tic-Tac-Toe demo application
    2. Building the Tic-Tac-Toe game
      1. Conceiving and implementing your first Tic-Tac-Toe feature
      2. Targeting different .NET Core versions in the .csproj files of your projects
      3. Using the Microsoft.AspNetCore.App metapackage
    3. Introduction to the default ASP.NET Core 3 classes
      1. ASP.NET Core 3 start up classes
        1. Working with the Program class
        2. Working with .NET Generic Host instead of WebHostBuilder
        3. Working with the Startup class
    4. Preparing the basic project structure
    5. Creating the Tic-Tac-Toe home page
    6. Giving your web pages a more modern look by using NPM and layout pages
      1. Updating the layout page
    7. Creating the Tic-Tac-Toe user registration page
    8. Creating the Tic-Tac-Toe user service
      1. Using DI to encourage loose coupling
      2. Creating the user service
    9. Creating a basic communication middleware for the Tic-Tac-Toe application
      1. Working with middleware
      2. Creating the communication middleware
      3. Working with static files
      4. Using routing, URL redirection, and URL rewriting
        1. Endpoint routing for ASP.NET Core 3
    10. Adding error handling to the Tic-Tac-Toe application
    11. Summary
  13. Basic Concepts of ASP.NET Core 3 via a Custom Application: Part 2
    1. Client-side development using JavaScript
      1. Preliminary email confirmation functionality
        1. Email confirmation by our user
        2. Using XMLHttpRequest
    2. Optimizing your web applications and using bundling and minification
      1. Bundling and minification in action
    3. Working with WebSockets for real-time communication scenarios
      1. WebSockets in action
    4. Taking advantage of session and user cache management
      1. In-memory session providers
      2. Distributed session providers
    5. Applying globalization and localization for multi-lingual user interfaces
      1. Globalization and localization concepts
      2. Using the view localizer 
      3. Localizing Data Annotations
    6. Configuring your applications and services
      1. Adding an email service
      2. Configuring the email service
    7. Implementing advanced dependency injection concepts
      1. Method injection
    8. Summary
  14. Introducing Razor Components and SignalR
    1. Client-side development using C# Razor components
    2. Working with SignalR
      1. What is SignalR
      2. SignalR with server-side Blazor or Razor components
    3. Using logging and telemetry for monitoring and supervision purposes
    4. Building once and running on multiple environments
    5. Summary
  15. Creating ASP.NET Core MVC Applications
    1. Understanding the Model View Controller pattern
      1. Models
      2. Views
      3. Controllers
      4. Unit tests
      5. Integration tests
    2. Creating dedicated layouts for multiple devices
      1. The layout page in more detail
      2. Optimizing for mobile devices
    3. Understanding ASP.NET Core state management
      1. Client-state management options
        1. Hidden fields 
        2. Cookies
        3. Query string
          1. Query string usage
      2. Server-based state management options
        1. Application state
        2. Session state
    4. Using view pages, partial views, View Components, and Tag Helpers
      1. Using view pages
      2. Using partial views
      3. Using View Components
      4. Using Tag Helpers
    5. Dividing a web application into multiple areas
    6. Applying advanced concepts such as view engines, unit tests, and integration tests
      1. Using view engines
      2. Providing better quality by creating unit tests and integration tests
      3. Adding unit tests
      4. Adding integration tests
    7. Layering ASP.NET Core 3 applications
      1. Determining the required layers
      2. Deciding on the distribution for layers and components
      3. Determining rules for interactions between layers
      4. Identifying cross-cutting concerns
    8. Summary
  16. Creating Web API Applications
    1. Technical requirements
    2. Applying web API concepts and best practices
      1. Building RPC-style web APIs
      2. Building REST-style web APIs
      3. Building HATEOAS-style web APIs
    3. Securing your web API
    4. ASP.NET Core web API help pages with Swagger/OpenAPI
    5. Summary
  17. Section 3: The ASP.NET Core 3 Supporting Ecosystem
  18. Accessing Data Using Entity Framework Core 3
    1. Getting started with Entity Framework Core 3
      1. Establishing a connection
      2. Defining primary keys and foreign keys via Data Annotations
      3. Using Entity Framework Core 3 migrations
      4. Creating, reading, updating, and deleting data
    2. Understanding data relationships
      1. Primary key
      2. Foreign key
      3. One-to-one relationships
      4. One-to-many relationships
      5. Many-to-many relationships
    3. Working with queries
      1. Querying for one item
      2. Querying  for all items
      3. Querying for filtered items
    4. Using transactions
    5. Summary
  19. Securing ASP.NET Core 3 Applications
    1. Implementing authentication
      1. Adding basic user form authentication
      2. Adding external provider authentication
      3. Working with two-factor authentication
        1. Two-factor authentication - step by step
      4. Adding forgotten password and password reset mechanisms
    2. Implementing authorization
    3. Summary
  20. Securing ASP.NET Applications - Vulnerabilities
    1. Cross-Site Scripting (XSS)
      1. Preventing XSS
    2. Cookie stealing
      1. Preventing cookie stealing
    3. Eavesdropping, message tampering, and message replay
      1. Preventing eavesdropping and message replay
    4. Open redirects/XSR
      1. Open redirects example
      2. Preventing open redirects
    5. SQL injection
      1. Preventing SQL injection
        1. Protecting SQL connection strings
          1. Using the Persist Security Info default value in connection strings
        2. Using object-relational mappers (ORMs)
    6. Cross-Site Request Forgery (XSRF/CSRF)
      1. XSRF/CSRF example
      2. Preventing XSRF/CSRF
        1. Domain referrers
        2. User-generated tokens
        3. Limitations
    7. JS/JSON hijacking
      1. Preventing JSON hijacking
    8. Over-posting
      1. Vulnerability example
      2. Preventing over-posting
    9. Clickjacking
      1. Clickjacking example
      2. Preventing clickjacking
    10. Proper error reporting and stack trace
      1. Error reporting vulnerability example
      2. Preventing a screen of death
    11. Summary
  21. Hosting ASP.NET Core 3 Applications
    1. Hosting applications
    2. Deploying applications in AWS
      1. Deploying applications in AWS Elastic Beanstalk
      2. Getting the application running on AWS
    3. Deploying applications in Microsoft Azure
      1. Deploying applications in Microsoft Azure App Service
        1. Getting an Azure App Service instance running
        2. Publishing your code on Azure
          1. Continuous integration with Azure Repos
        3. Connecting the database
        4. Deployment through the Web Deploy tool
    4. Deploying applications into Docker containers
      1. Deploying applications into Docker containers 
      2. Publishing images to Docker Hub
    5. Summary
  22. Managing ASP.NET Core 3 Applications
    1. Logging in ASP.NET Core 3 applications
      1. Logging in Microsoft Azure
      2. Enabling Microsoft Azure App Service
      3. Logging in AWS
    2. Monitoring ASP.NET Core 3 applications
      1. Monitoring on-premises and in Docker
      2. Monitoring in Microsoft Azure
      3. Monitoring in AWS
    3. Summary
  23. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think
18.221.85.142