How to access NancyFX header values

I need to get some shibboleth values ​​from the Request.Headers collection. I am currently managing to do this using the following code:

 CommonName = Request.Headers["cn"].FirstOrDefault(); Email = Request.Headers["mail"].FirstOrDefault(); 

Is there less cumbersome syntax for getting header values? I was hoping to see a dynamic object like Query or Form , so I could use dynamic property names, something like this:

 CommonName = Request.Headers.cn; Email = Request.Headers.mail; 

Thanks.

+8
source share
1 answer

Headers are configured to provide more robust typing support for regular headers; if you use custom headers, you get a slightly ugly syntax if you don't write your own wrapper.

+6
source share

All Articles