将用户从一个视图重定向到另一个视图或在SignalR集线器中使用

问题描述 投票:0回答:1

我有使用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面板并显示页面的其他内容,以便我的集线器连接继续接收事件。我想将登录表单移到另一个视图,登录成功后,它应该重定向到另一个视图,并且我的集线器连接应该开始接收新视图的事件。我该如何实现。

javascript asp.net-mvc redirect view signalr-hub
1个回答
0
投票

登录成功使用后,我也做了相同的事情

enter code here->return (RedirectToAction("chatIndex", "Home", new { Username = loggedInUser.USERID }));

其中chatIndex是我的聊天窗口,其中包含所有在线脱机用户的列表。

© www.soinside.com 2019 - 2024. All rights reserved.