Posts

Showing posts from April, 2026

Introduction

  Blazor is a .NET frontend web framework that supports both server-side rendering and client interactivity in a single programming model. managed it services Learning objectives After completing this module, you'll be able to: Combine HTML and C# to define dynamic page rendering logic Render API responses in Blazor Web apps Create pages that perform HTTP operations mobile app development

Summary

  In this module you learned how to: Implement HTTP clients in .NET Core. Use HTTP clients to perform safe and unsafe operations. Add code to support HTTP operations in an ASP.NET Core Blazor Web app. crm

Exercise - Explore service lifetimes

  In the previous exercise, you registered services using the singleton service lifetime. In a code review, your team lead asks you to investigate the differences between the   singleton ,   scoped , and   transient   service lifetimes. power bi training courses malaysia Test the singleton service lifetime The app should still be running from the previous exercise. If it's not, run the app as before. Refresh the browser window and note the time displayed in the welcome message. Wait a few seconds, and then refresh the browser window again. The welcome message doesn't change. The timestamp and GUID remain the same. The time and GUID displayed in the welcome message don't change because the  WelcomeService  service is registered as a Singleton service. The service is created once when the app starts and is reused for the lifetime of the app. Every request, from every client, uses the same instance of the service. No other instance of the service is creat...

Exercise - Create custom middleware

Image
  Developers can create custom middleware components to add functionality to an ASP.NET Core app. Custom middleware can be inserted anywhere in the middleware pipeline and can be used with built-in middleware components, as seen in this example: Your company's network operations team is troubleshooting performance issues in the production environment. Your team lead tasked you to implement some features to better support real-time monitoring of the app. The app should log request details to the console. For each request, it should log the request method, path, and response status code. In this exercise, you create a custom middleware component that logs request details to the console. cisco certification training courses malaysia Add custom middleware Let's modify the existing ASP.NET Core app to include custom middleware that logs request details to the console. Open the  Program.cs  file if it's not open already. Immediately before  app.Run() , insert the following...

Complete the challenge

  Code challenges throughout these modules will reinforce what you've learned and help you gain some confidence before continuing on. lean it certification training courses malaysia Challenge: Write code in the C# Code Editor to display two messages Select all of the code in the  C# Code Editor , and press  Delete  or  Backspace  to delete it. Write code that produces the following output: Output This is the first line. This is the second line. In the previous unit, you learned how to display a message in just one line of code, and you learned how to display a message using multiple lines of code. Use both techniques for this challenge. It doesn't matter which technique you apply to which line, and it doesn't matter how many ways you split one of the messages into multiple lines of code. That's your choice. No matter how you do it, your code should produce the specified output. kubernetes training courses malaysia Whether you get stuck and need to peek at t...

Exercise - Run your web app locally

Image
  In this exercise, you will: Run your web app locally and view it in a browser. Review how the web app is served. Run the web app and view in a browser Run the web app in Visual Studio Code and view in a browser: In Visual Studio Code, press  F5  to run the app. Visual Studio Code: Triggers the .NET CLI command  dotnet run  which builds and runs the application. Attaches the debugger to the running application. The first time the project is run in Visual Studio Code, the  Select debugger  prompt is displayed. At the  Select debugger  prompt in the  Command Palette  at the top of the Visual Studio Code UI, select  C# . At the next prompt, select the default launch configuration ( C#: MyWebApp [Default Configuration] ): The default browser is launched at  http://localhost:{PORT} , which displays the app's response. The  {PORT}  placeholder is the random port assigned to the app when the app's project is created. I...