简体   繁体   中英

How to get session details using session id in ASP.NET MVC

I want to access user session values outside of the controller where HttpContext is null. Can we read data from the session even when HttpContext is null if we know the session ID?

Tried to create a singleton class and set the values but its not solving our purpose.

Suppose I have UI project which is of ASP.NET MVC type. There I have a SignalR handler. I want access some data which is stored in session when I get a message at SignalR handler.

you can use Session.Add("Name", Name of item you need); while login and you can access it in any page by Session["Name"].

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM