简体   繁体   中英

How to pass data from controller to SignalR hub class

I working on a simple chat project. The project consist of two pages, one for log in and one for chatting. The controller of the log in page check the username and password of the user and if its correct, it store the user id and username in session["Info"].

The problem is that I can't get the username and user id from SignalR hub class because session can't be used in hub class. So I need a way to pass data from the log in controller to the hub class.

之后,我将使用标准ASP.NET安全性,您可以始终使用户使用MVC控制器和SignalR或核心业务逻辑等中的标准ASP.NET功能。

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