asp.net-identity-2

Two questions about MVC, and Identity

安稳与你 提交于 2019-12-01 12:12:09
I am very new to identity and MVC, I am trying to create an MVC app as one of my first projects. I have been able to follow a few tutorials and have successfully added additional properties to my ApplicationUser : IdentityUser class public class ApplicationUser : IdentityUser<string, ApplicationUserLogin, ApplicationUserRole, ApplicationUserClaim> { [Required] [Display(Name = "UserName")] [StringLength(50)] public string Handle { get; set; } [StringLength(100, ErrorMessage = "Your {0} can be at most {1} characters long.")] [Display(Name = "First Name")] public string FirstName { get; set; }

ASP.Net MVC identity infinite redirect loop

社会主义新天地 提交于 2019-12-01 09:28:38
I have an ASP.Net MVC5 application, using the Identity "out of the box" template, as per ASP.Net Identity 2.0.0. I need to upgrade it to use the newer code that is in the latest ASP.Net MVC template, namely the use of the SignInManager class. I have done some A|B comparisons between the code in my original app and the template generated in the latest, and ported over all that I could see what different. However, I'm getting an odd error, I suspect OWIN related. When I try and Login or Register, it triggers a Redirect loop that eventually crashes the app with a security warning as the URL Query

ASP.NET Identity 2 relogin after deploy

怎甘沉沦 提交于 2019-12-01 08:08:50
I'm using asp.net mvc 5 together with Identity2, standard login/password authentication, with "remember me" checkbox. Imagine the scenario: user logs in (standard auth cookie) application is redeployed user needs to relogin again. Questions: Is it possible not to relogin after deploy? Sometimes, after deploy when you refreshes a page, that requires authorized access - it displays correctly, but if you refresh the second time - it redirects to login page. All these happens when deployed to IIS7, locally on IIS Express everything is ok. The reason that you have to relogin is because the machine

ASP.NET Identity 2 relogin after deploy

白昼怎懂夜的黑 提交于 2019-12-01 06:14:58
问题 I'm using asp.net mvc 5 together with Identity2, standard login/password authentication, with "remember me" checkbox. Imagine the scenario: user logs in (standard auth cookie) application is redeployed user needs to relogin again. Questions: Is it possible not to relogin after deploy? Sometimes, after deploy when you refreshes a page, that requires authorized access - it displays correctly, but if you refresh the second time - it redirects to login page. All these happens when deployed to

ASP.Net MVC identity infinite redirect loop

亡梦爱人 提交于 2019-12-01 05:49:18
问题 I have an ASP.Net MVC5 application, using the Identity "out of the box" template, as per ASP.Net Identity 2.0.0. I need to upgrade it to use the newer code that is in the latest ASP.Net MVC template, namely the use of the SignInManager class. I have done some A|B comparisons between the code in my original app and the template generated in the latest, and ported over all that I could see what different. However, I'm getting an odd error, I suspect OWIN related. When I try and Login or

AddToRole and IdentityRole is not part of the model for the current context

余生颓废 提交于 2019-11-30 23:07:00
I'm using Identity 2.1 to handle the user roles in my asp.net application. So far so good, i created new context extending from IdentityDBContext, extending the IdentityUser and IdentityRole to add a couple of new fields. However, whenever im trying to add a user to a specific role using the UserManager im getting The entity type IdentityRole is not part of the model for the current context. . So there seem to be something wrong with the user-role relationship, here is my code so far for reference: User public class User : IdentityUser{ public string Name { get; set; } public async Task

ASP.NET Identity 2.1 and EF 6 - ApplicationUser relationships with other entities

点点圈 提交于 2019-11-30 23:06:16
Can't seem to find an answer to this one, even though what I'm doing seems like it would be common and important to most developers. In most systems with user accounts, the user table is tied to other tables in the database. That's all I want. I'm using MSSQL Express 2012 and VS 2013. I have a class library where I'm using the code-first approach to generate tables. I moved the IdentityModel class from the MVC project to this class library as well. Everything works separately - my tables are generated and work fine, and the Identity tables are generated when I register a new user. However, now

Stuck between two errors in an Azure OAuth2 token request

和自甴很熟 提交于 2019-11-30 18:54:10
I am implementing an OAuth2 provider for OWIN and Azure Active Director. FWIW, at this time the OpenId Connect option doesn't fit the requirements for this work. I get an auth code, and returned to my reply url with the auth_code, state, and make the request for a token to "scheme://login.windows.net/{myguid}/oauth2/token. // Build up the body for the token request var body = new List<KeyValuePair<string, string>>(); body.Add(new KeyValuePair<string, string>("grant_type", "authorization_code")); body.Add(new KeyValuePair<string, string>("code", code)); body.Add(new KeyValuePair<string, string>

AddToRole and IdentityRole is not part of the model for the current context

你。 提交于 2019-11-30 18:10:58
问题 I'm using Identity 2.1 to handle the user roles in my asp.net application. So far so good, i created new context extending from IdentityDBContext, extending the IdentityUser and IdentityRole to add a couple of new fields. However, whenever im trying to add a user to a specific role using the UserManager im getting The entity type IdentityRole is not part of the model for the current context. . So there seem to be something wrong with the user-role relationship, here is my code so far for

Make ASP.NET Identity 2.0 Email confirm token work for WCF and MVC

為{幸葍}努か 提交于 2019-11-30 17:19:53
问题 I have a service project (WCF) and MVC project which uses same database, to handle service part for Mobile and Interface part. I have to set up email confirmation on both. I have used OWIN ASP.NET 2.0 library for authentication, and both projects have separate UserManagers. For MVC public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options, IOwinContext context) { var dataProtectionProvider = options.DataProtectionProvider; if (dataProtectionProvider !=