HTML to PDF Converter ASP.NET Core samples · .NET 10 and .NET 11

ExpertPdf Html To Pdf Converter for .NET - Helper Page - View HTTP Cookies - C# / ASP.NET Sample

This page shows the HTTP Cookies sent to it:

C# code of this sample

Pages/ViewHttpCookies.cshtml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace ExpertPdf.Samples.Pages
{
    public class ViewHttpCookiesModel : PageModel
    {
        public void OnGet()
        {
            string cookies = string.Empty;
            foreach (string key in Request.Cookies.Keys)
            {
                string cookie = Request.Cookies[key];
                cookies += "<br/>" + key + ": " + cookie;
            }

            ViewData.Add("cookiesValue", cookies);
        }
    }
}