asp.net mvc 4 - disconnect client from server side signalr -
i'm using signalr 1 mvc4 c# web application form authentication. have code in layout page in javascript :
$(documnet).ready(function(){ connect hub code ... })
i want disconnect user form hub , start connect again after login , validate ok. want server side inside account controller , method :
public actionresult logon(loginmodel model, string returnurl) { if (modelstate.isvalid) { if (system.web.security.membership.validateuser(model.username, model.password)) { formsauthentication.setauthcookie(model.username, false); ....here , disconnect hub ....to make user reconnect }
the reason want because signalr throws error if user changed authenticated after login , connection remains . error is:
the connection id in incorrect format.
you cannot stop , start signalr connections server. need call
$.connection.hub.stop(); //on client before user attempts log on , call $.connection.hub.start(); //after log on attempt has completed.
Comments
Post a Comment