, , , . OWIN. , , OWIN , , ( ) User Controller, User ClaimsIdentity.
, User ASP.NET. UserId, User, , . , Id Employee, DbContext. , , , StartupConfiguration:
public sealed class StartupConfig {
public void Configuration(
IAppBuilder app) {
this.ConfigureAuthentication(app);
}
public void ConfigureAuthentication(
IAppBuilder app) {
app.UseCookieAuthentication(new CookieAuthenticationOptions {
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/"),
ExpireTimeSpan = new TimeSpan(0, 60, 0)
});
}
}
UserId:
protected int UserId {
get {
return Convert.ToInt32(base.User.Identity.GetUserId());
}
}
[assembly: OwinStartupAttribute(typeof(namespace.StartupConfig))]. , -.