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

This page shows the HTTP Headers sent to it:

Connection: close
Accept: */*
Accept-Encoding: gzip, br, zstd, deflate
Host: selectpdf.com
User-Agent: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)


Sample Code C#



using System.Web.Mvc;

namespace SelectPdf.Samples.Controllers
{
    public class ViewHttpHeadersController : Controller
    {
        // GET: ViewHttpHeaders
        public ActionResult Index()
        {
            string headers = string.Empty;
            foreach (string name in Request.Headers)
            {
                string value = Request.Headers[name];
                headers += "<br/>" + name + ": " + value;
            }

            ViewData.Add("HeadersValue", headers);
            
            return View();
        }
    }
}