disconnect client from server side signalr

后端 未结 6 1320
梦如初夏
梦如初夏 2021-02-19 06:39

I\'m using SignalR 1 with MVC4 C# web application with form authentication. I have a code in my layout page in JavaScript :

$(documnet).ready(function(){
               


        
6条回答
  •  深忆病人
    2021-02-19 07:23

    Try this:

    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);
                connection.Stop();
            }
    }
    

    Assuming your connection handle is connection. The challenge is accessing a handle to your connection object in your Action Method.

提交回复
热议问题