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