SelectPdf for .NET - Helper Page - View HTTP Cookies - C# / ASP.NET MVC Sample

This page shows the HTTP Cookies sent to it:


Sample Code C#



using System.Web;
using System.Web.Mvc;

namespace SelectPdf.Samples.Controllers
{
    public class ViewHttpCookiesController : Controller
    {
        // GET: ViewHttpCookies
        public ActionResult Index()
        {
            string cookies = string.Empty;
            foreach (string key in Request.Cookies)
            {
                HttpCookie cookie = Request.Cookies[key];
                cookies += "<br/>" + cookie.Name + ": " + cookie.Value;
            }

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