ExpertPdf Anywhere ASP.NET Core samples · .NET 10 and .NET 11

ExpertPdf Anywhere - Helper Page - View HTTP Cookies - C# / ASP.NET Sample

This page shows the HTTP Cookies sent to it:

.AspNetCore.Antiforgery.pYv0q5nZIsw: CfDJ8PJNlcHp4PVDknI85UeDnSJCwwgElki-3ne8Nny21MIuK8Pf8FH8aL1vIlnP0GMQtBZ6fnJuqCdThHf8gCMOK0euBNvoOQb4vWFMOhrgybeLxLDOZhN163U_vAE_PWVEOWElMEuplDSbAgOLn9r_dvU

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);
        }
    }
}