SessionMiddlewareExtensions.UseSession Method

Definition

Overloads

UseSession(IApplicationBuilder)

Adds the SessionMiddleware to automatically enable session state for the application.

UseSession(IApplicationBuilder, SessionOptions)

Adds the SessionMiddleware to automatically enable session state for the application.

UseSession(IApplicationBuilder)

Source:
SessionMiddlewareExtensions.cs
Source:
SessionMiddlewareExtensions.cs
Source:
SessionMiddlewareExtensions.cs

Adds the SessionMiddleware to automatically enable session state for the application.

C#
public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseSession (this Microsoft.AspNetCore.Builder.IApplicationBuilder app);

Parameters

Returns

The IApplicationBuilder.

Applies to

ASP.NET Core 9.0 and other versions
Product Versions
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

UseSession(IApplicationBuilder, SessionOptions)

Source:
SessionMiddlewareExtensions.cs
Source:
SessionMiddlewareExtensions.cs
Source:
SessionMiddlewareExtensions.cs

Adds the SessionMiddleware to automatically enable session state for the application.

C#
public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseSession (this Microsoft.AspNetCore.Builder.IApplicationBuilder app, Microsoft.AspNetCore.Builder.SessionOptions options);

Parameters

Returns

The IApplicationBuilder.

Applies to

ASP.NET Core 9.0 and other versions
Product Versions
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0