1
我目前正在设计一款游戏,需要从我的视图中检索一个值并将其发送到我的SingalR集线器。使用MVC,我想从我的cshtml视图中检索一个值并将其存储在我的SignalR中心
我想将从我的视图中检索到的值存储在我的集线器中的全局变量中。如下
例子:
查看
<html>
Viewbag.a=1 //the value i want to send to the hub
<html>
枢纽
int a; //global variable in hub
public void retrieve(int num) //my method to store value
{
a=num;
}