Nizamuddin Siddiqui

Nizamuddin Siddiqui

1,958 Articles Published

Articles by Nizamuddin Siddiqui

Page 22 of 196

How do we specify MIME type in Asp.Net WebAPI C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 2K+ Views

A media type, also called a MIME type, identifies the format of a piece of data. In HTTP, media types describe the format of the message body. A media type consists of two strings, a type and a subtype. For example − text/html image/png application/json When an HTTP message contains an entity-body, the Content-Type header specifies the format of the message body. This tells the receiver how to parse the contents of the message body. When the client sends a request message, it can include an Accept header. The Accept header tells the server which ...

Read More

How to run an external application through a C# application?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 5K+ Views

An external application can be run from a C# application using the Process class. A process is a program that is running on your computer. This can be anything from a small background task, such as a spell-checker or system events handler, to a full-blown application like Notepad. Each process provides the resources needed to execute a program and is started with a single thread, known as the primary thread. Processes are heavily dependent on system resources, while threads require minimal resources. The Process class is present in the System.Diagnostics namespace. Syntax Following is the basic syntax ...

Read More

What is the use of the Configure() method of startup class in C# Asp.net Core?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 2K+ Views

The Configure() method in ASP.NET Core's Startup class is used to define the application's request pipeline. This method configures how the application handles incoming HTTP requests and outgoing responses using middleware components. The Configure() method is called at runtime after the ConfigureServices() method. It receives an IApplicationBuilder instance from the built-in IoC container, which is used to add middleware to the request pipeline. Syntax Following is the basic syntax of the Configure() method − public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { // Configure middleware pipeline } Parameters The ...

Read More

What is the use of "Map" extension while adding middleware to C# ASP.NET Core pipeline?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 3K+ Views

The Map extension method in ASP.NET Core is used for conditional middleware execution based on the request path. It allows you to branch the middleware pipeline and execute different middleware components for specific URL paths, creating a more organized and efficient request handling system. Middleware components are assembled into an application pipeline to handle requests and responses. Each component can choose whether to pass the request to the next component and perform actions before and after the next component is invoked. Syntax Following is the syntax for using the Map extension method − app.Map("/path", appBuilder ...

Read More

What is the difference between IApplicationBuilder.Use() and IApplicationBuilder.Run() C# Asp.net Core?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 5K+ Views

We can configure middleware in the Configure method of the Startup class using IApplicationBuilder instance. The two primary methods for adding middleware are Run() and Use(), each serving different purposes in the middleware pipeline. Run() is an extension method that adds a terminal middleware to the application's request pipeline, meaning it terminates the pipeline and does not call the next middleware. Use() allows middleware to pass control to the next component in the pipeline. Syntax Following is the syntax for the Run() method − public static void Run(this IApplicationBuilder app, RequestDelegate handler) Following ...

Read More

How to enable Session in C# ASP.NET Core?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 18K+ Views

Session is a server-side storage feature in ASP.NET Core that enables you to store user data temporarily across multiple requests. Session data is stored in a dictionary on the server, with each user session identified by a unique SessionId. The SessionId is stored as a cookie on the client side and sent with every request to maintain the connection between the client and their session data. This cookie is browser-specific and cannot be shared between different browsers. While SessionId cookies persist only for the browser session, the actual session data on the server has a configurable timeout (default: 20 ...

Read More

How can we inject the service dependency into the controller C# Asp.net Core?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 1K+ Views

ASP.NET Core uses a built-in Inversion of Control (IoC) container to inject dependencies into controllers and other services. This container, represented by the IServiceProvider implementation, supports constructor injection by default and manages application services throughout their lifecycle. To use dependency injection in controllers, you must first register your services with the IoC container in the ConfigureServices method of the Startup class or Program.cs file. Syntax Following is the syntax for registering services in the IoC container − services.AddSingleton(); services.AddScoped(); services.AddTransient(); Following is the syntax for constructor injection in a controller − ...

Read More

How to specify service lifetime for register service that added as a dependency C# Asp.net Core?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 705 Views

The built-in IoC container in ASP.NET Core manages the lifetime of registered services and automatically disposes service instances based on the specified lifetime. Understanding service lifetimes is crucial for proper dependency injection and resource management. The built-in IoC container supports three kinds of lifetimes − Singleton − IoC container will create and share a single instance of a service throughout the application's lifetime. Transient − The IoC container will create a new instance of the specified service type every time you ask for it. Scoped − IoC container will create an instance of the specified service type ...

Read More

How C# ASP.NET Core Middleware is different from HttpModule?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 1K+ Views

In ASP.NET Core, middleware replaces the traditional HttpModules used in classic ASP.NET. While both serve as components that handle HTTP requests and responses, they differ significantly in configuration, execution control, and architecture. Key Differences Overview HttpModules are event-driven components tied to the ASP.NET application lifecycle, while middleware components form a pipeline where each component can handle requests before passing them to the next component in the chain. HttpModules vs Middleware Architecture HttpModules (Classic ASP.NET) Event-driven execution Fixed lifecycle ...

Read More

What is Kestral C# Asp.net Core?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 4K+ Views

Kestrel is a cross-platform web server for ASP.NET Core. It is included by default in ASP.NET Core applications and is supported on all platforms where .NET Core runs. Kestrel serves as the primary HTTP server for ASP.NET Core applications and can be configured to work either as a standalone edge server or in combination with reverse proxy servers like IIS, Nginx, or Apache. Key Features Cross-platform: Runs on Windows, macOS, and Linux. Lightweight: Minimal overhead and high performance. HTTP/HTTPS support: Handles both HTTP and HTTPS protocols. Async/await support: Built ...

Read More
Showing 211–220 of 1,958 articles
« Prev 1 20 21 22 23 24 196 Next »
Advertisements