4

I'm trying to use ASP.NET Identity and SignalR (2.0.1) in new default project.

When I comment line app.MapSignalR(); in class Startup, login is working perfect. I get "user" in method LogIn, username of logged user is show on page (via Context.User.Identity.GetUserName()).

When I uncomment line app.MapSignalR(); in class Startup, I get "user" in method LogIn but username of logged user is not show. When I was using old memebership and SignalR, everything worked ok. Did I miss something?

protected void LogIn(object sender, EventArgs e)
{
    if (IsValid)
    {
        // Validate the user password
        var manager = new UserManager();
        ApplicationUser user = manager.Find(UserName.Text, Password.Text);
        if (user != null)
        {
            IdentityHelper.SignIn(manager, user, RememberMe.Checked);
            IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response);
        }
        else
        {
            FailureText.Text = "Invalid username or password.";
            ErrorMessage.Visible = true;
        }
    }
}


using Microsoft.Owin;
using Owin;

[assembly: OwinStartupAttribute(typeof(Tmp.Startup))]
namespace Tmp
{
    public partial class Startup {
        public void Configuration(IAppBuilder app) {
            app.MapSignalR();
        }
    }
}
OptimizedQuery
  • 1,262
  • 11
  • 21
  • Possibly because you have 2 startup attributes? Where is the auth configured? Why not add MapSignalR to the existing Configuration method? – davidfowl Jan 07 '14 at 06:29

1 Answers1

0

Check your packages looks like your using webforms and SignalR. SignalR runs on the owin pipeline.

If your running IIS you're need the following packages:

  • Microsoft.Owin.Host.SystemWeb (OWIN-based applications to run on IIS using the ASP.NET request pipeline in your case webforms)

  • Microsoft.AspNet.SignalR.SystemWeb (Allows SignalR to run on IIS using the ASP.NET request pipeline)

DalSoft
  • 10,673
  • 3
  • 42
  • 55