I need to get some custom (shibboleth) header values out the Request.Headers
collection. Currently I am managing to do this using the following code:
CommonName = Request.Headers["cn"].FirstOrDefault();
Email = Request.Headers["mail"].FirstOrDefault();
Is there a less cumbersome syntax to get at the header values? I was hoping to see a dynamic object, like the Query
or the Form
so I could use dynamic property names, something like this:
CommonName = Request.Headers.cn;
Email = Request.Headers.mail;
Thank you.
The headers is set up this way to give better strong typing support for the common headers; if you're using non-standard headers you'll get slightly uglier syntax unless you write you own wrapper around them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With