我有使用signalR的MVC应用程序。目前,我只有1个具有登录名和其他详细信息的表单(cshtml)。当我单击登录时,与集线器的连接将启动
$.connection.hub.start().done(function () {
$('#login').click(function () {
// call the Login method on the hub
var tokenRequestResponse = integrationServerHub.server
.login($('#username').val(), $('#password').val())
.done(processTokenRequestResponse);
$('#events').val('');
$('#events').prepend("login.click" + "\n");
});
并且登录成功后,我将隐藏登录div面板并显示页面的其他内容,以便我的集线器连接继续接收事件。我想将登录表单移到另一个视图,登录成功后,它应该重定向到另一个视图,并且我的集线器连接应该开始接收新视图的事件。我该如何实现。
登录成功使用后,我也做了相同的事情
enter code here->return (RedirectToAction("chatIndex", "Home", new { Username = loggedInUser.USERID }));
其中chatIndex是我的聊天窗口,其中包含所有在线脱机用户的列表。