I have created a signalr project.

Class StartUp

public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        app.MapSignalR();
    }
}

My class MyHub:

public class MyHub : Hub
{
    public override Task OnConnected()
    {
        string name = Context.User.Identity.Name;// Context.User is null
        string connectionId = Context.ConnectionId;//Context.ConnectionId has value
        return base.OnConnected();
    }

    public override Task OnDisconnected(bool stopCalled)
    {
        return base.OnDisconnected(stopCalled);
    }

When I connect my Client to the Server, it runs OnConnected() method.

Context.ConnectionId is NOT null, Context.User is null.

Please tell me why and how to solve it?

Note: this is Winform, not Webform like I've searched some topics like this.

If there is any downvote, please explain why. This is NOT duplicate topic. My problem is in Winform.

Related posts

Recent Viewed