How to know if an HTTP request header value exists
if (Request.Headers[“XYZComponent”].Count() > 0) … will attempted to count the number of characters in the returned string, but if the header doesn’t exist it will return NULL, hence why it’s throwing an exception. Your second example effectively does the same thing, it will search through the collection of Headers and return NULL if it doesn’t … Read more