Global variable in Web API
问题 I have a Web API application that is authenticated using a combination of userid and an APIKey as part of the RequestMessage. In my authorization filter I check if the combination is valid before proceeding. I then need to use the userid to log some actions in my controllers. The UserID and key are encoded together. Something like: .../api/v1/Transaction?api_key=YmFyZGFnYWR2ZXJndXI The problem I am having is how to expose the userid to the controller. 回答1: Using the comment from Chips_100 I