How should I store per request data when using OWIN to Self-Host ASP.NET Web API

浪尽此生 提交于 2019-12-21 19:27:17

问题


I'm in the process of converting my ASP.NET Web API from being IIS hosted to being self hosted.

In one of my DelegatingHandlers I set the current user based on the token from the HTTP header. I've been using HttpContext.Current.Items to store this information, but that isn't available under self hosting.

What is the correct way to store per request data that can be accessed anywhere in my application?


回答1:


The Request message has a Properties collection.



来源:https://stackoverflow.com/questions/19788153/how-should-i-store-per-request-data-when-using-owin-to-self-host-asp-net-web-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!