Lab Lab Lab Lab - 10 months ago 59
Javascript Question

How can i redirect (kick) users by a button click?

I have a list of users, that are logged in a page. And i as an admin can see the button which should have kick any user.
Here is the code of list of users

foreach (var user in Model.Users)
var userId = user.Name.ToUpper().Replace(" ", "") + "user";
<li id='@userId'>

<a href="javascript:void(0)">
<i class="status @(user.IsOnline ? "online" : "offline")"></i>
@if (User.Identity.Name == Model.OwnerName)
<a id="kickEz" class="waves-effect right">KICK</a>
@if (admin)
<a id="kickEz" class="waves-effect right">KICK</a>




How can i redirect users to another page in controller and log them off?

Answer Source

The best way is to use a server.hub.someMethod. It's the only way to call SignalR methods on the server

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download