Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Server Side Programming Articles - Page 1032 of 2650
4K+ Views
In typical web applications, the communication flow is one-way, i.e. from client to the server. The client initiates a request to the server, the server performs some task, and sends the response to the client.SignalR is an open-source project that enables real-time, bi-directional web communication from server to clients. Using SignalR, you can write server-side code that can communicate with the clients instantly.SignalR simplifies the process of adding real-time web functionality to web applications, where the server code pushes content to connected clients as soon as it becomes available. This frees the clients from repeatedly polling the server, and having ... Read More
924 Views
When building or using web applications, it’s very common to run into errors. Hence it’s important to configure error handling for your web application and handle the errors gracefully to provide a suitable response to the user. This improves the usability of your application as well as makes it robust.There are many different errors that can happen in a normal application flow. However, the two important types of errors are exceptions and error status codes, e.g. 404, 502. Exceptions occur when the app runs into an unexpected circumstance. A very common example of an exception is the notorious NullReferenceException, which ... Read More
829 Views
Static files refer to content such as HTML, CSS, JavaScript, and images that are served directly to the users without any dynamic computation.In ASP.NET Core, the web root directory holds the static files. By default, it is the {content root}/wwwroot directory, but you can change it using the UseWebRoot() method.In the Program class, the CreateDefaultBuilder() method initializes the content root.public class Program{ public static void Main(string[] args){ CreateHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder =>{ webBuilder.UseStartup(); ... Read More
1K+ Views
In the context of web application frameworks, routing matches an incoming HTTP request to executable code. The executable code works as an endpoint that handles the request and returns a response.ASP.NET Core defines and configures the endpoints when the application starts. Routing also handles extracting the values from the request, building appropriate objects, and passing them to the methods that handle the request.Routing has been an important part of ASP.NET Core from the beginning. However, ASP.NET Core 3.0 introduced a new routing system called endpoint routing. It decouples routing from the MVC framework and makes it a more fundamental feature ... Read More
2K+ Views
Razor Pages simplify the traditional MVC-based programming model by adopting a file-based routing. Razor Pages focus on page-based scenarios for building web applications rather than using controllers and views like a traditional ASP.NET MVC application.Once the application receives an HTTP request, it moves through the middleware pipeline until it reaches a middleware component that can handle and process it. Typically, it's a routing middleware that matches a URL path to a configured route. This route defines which Razor page to invoke for this particular request.Once the router has selected the Razor Page, the framework executes that Razor Page to generate ... Read More
10K+ Views
Kestrel is a lightweight, cross-platform, and open-source web server for ASP.NET Core. It is included and enabled by default in ASP.NET Core. Kestrel is supported on all platforms and versions supported by .NET Core.In the Program class, the ConfigureWebHostDefaults() method configures Kestrel as the web server for the ASP.NET Core application.public class Program{ public static void Main(string[] args){ CreateHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder =>{ webBuilder.UseStartup(); }); }Though Kestrel can serve an ... Read More
4K+ Views
The Startup class configures your application's services and defines the middleware pipeline.Generally speaking, the Program class is where you configure your application's infrastructure, such as the HTTP server, integration with IIS, and configuration sources. In contrast, the Startup class defines which components and features your application uses and the middleware pipeline for your app.Startup.csHere is a sample Startup.cs file in a standard ASP.NET Core application.using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; namespace TutorialsPoint{ public class Startup{ public Startup(IConfiguration configuration){ ... Read More
840 Views
An ASP.NET Core application starts similarly to a .NET Console application. It uses the Main() method defined in the Program.cs file as the entry point of the application. The framework calls the Main() method whenever you start the web application.In the ASP.NET Core application, the Main() method builds and runs the Host. The Host object is one of the essential parts of the ASP.NET Core application. It contains the configuration and the webserver (Kestrel) that your application uses.Program.csHere is a sample Program.cs file in a standard ASP.NET Core application.using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; ... Read More
4K+ Views
The .csproj file tells dotnet how to build the ASP.NET application. It’s one of the most important files in an ASP.NET project.An ASP.NET project can depend on third-party libraries developed by other developers. Usually, these libraries are installed as Nuget packages using Nuget package manager. Once you install a package using Nuget, the name of the package along with its version is listed in the .csproj file.If you are familiar with Node.js, you can think of a .csproj file as a package.json file. Upon running the ‘dotnet restore’ command, dotnet uses the .csproj file to determine the packages to install ... Read More
343 Views
Before you begin with ASP.NET Core, you need to install the .NET software development kit (SDK) using the following link.Download .NET SDKTo check if everything is installed correctly, open a new terminal window and run the following command:$ dotnet --versionIf the installation was successful, the program should report its version, e.g. 5.0.100.Create Your AppNow that you have installed the framework, you can create a new ASP.NET application. NET comes with several pre-configured generators designed to make the developer’s life easier by creating everything necessary to start working on a project.To see all the available generators, run the dotnet new command ... Read More