Home > ASP.NET > How to Read, Write and Clear Cookies in ASP.Net Core



How to Read, Write and Clear Cookies in ASP.Net Core

In this article, we will explain how to Read, Write and Clear Cookies in ASP .NET Core with an example and sample code.


In this article, we will explain how to Read, Write and Clear Cookies in ASP .NET Core with an example and sample code. Here we are using Cookies to store data. We have taken login page and Dashboard page for this activity. When user will login in system value set in Cookie using CookieOptions class.

 

Required Namespaces

We will need to use the following namespaces.

 

LoginController

we have created login controller and we are assigning values in Cookies using CookieOptions class.

 

Index.Cshtml

We have created login html page you can see below.

 

DashboardController

We have created Dashboard page to Read and Clear Cookies values.




Note: All contents are copyright of their authors.



Comments



Leave a Reply

Comment:*
Email ID:*


Name:*