SignalR Secure Connection Between .NET Client and The Server

后端 未结 1 1417
旧时难觅i
旧时难觅i 2021-02-07 14:42

On SignalR .NET, we establish a connection as below between the client and server:

var connection = new HubConnection(\"http://mysite/\");

Next

1条回答
  •  甜味超标
    2021-02-07 15:06

    Here is how I have mine set up:

      var hubConnection = new HubConnection("http://siteurl");
      hubConnection.Credentials = CredentialCache.DefaultNetworkCredentials;
      hubProxy = hubConnection.CreateProxy("My.Hub.Namespace");
    
      hubConnection.Start().Wait();
    

    You could of course pass in different credentials, I use DefaultNetworkCredentials

    The credentials returned by DefaultNetworkCredentials represents the authentication credentials for the current security context in which the application is running. For a client-side application, these are usually the Windows credentials (user name, password, and domain) of the user running the application. For ASP.NET applications, the default network credentials are the user credentials of the logged-in user, or the user being impersonated.

    0 讨论(0)
提交回复
热议问题