asp.net-identity

How can I change the table names when using ASP.NET Identity?

ぃ、小莉子 提交于 2019-12-16 20:16:13
问题 I am using the release version (RTM, not RC) of Visual Studio 2013 (downloaded from MSDN 2013-10-18) and therefore the latest (RTM) version of AspNet.Identity. When I create a new web project, I select "Individual User Accounts" for authentication. This creates the following tables: AspNetRoles AspNetUserClaims AspNetUserLogins AspNetUserRoles AspNetUsers When I register a new user (using the default template), these tables (listed above) are created and the AspNetUsers table has a record

ASP.NET_SessionId + OWIN Cookies do not send to browser

别来无恙 提交于 2019-12-16 20:13:23
问题 I have a strange problem with using Owin cookie authentication. When I start my IIS server authentication works perfectly fine on IE/Firefox and Chrome. I started doing some testing with Authentication and logging in on different platforms and I have come up with a strange error. Sporadically the Owin framework / IIS just doesn't send any cookies to the browsers. I will type in a username and password which is correct the code runs but no cookie gets delivered to the browser at all. If I

Create a default user account using ASP.NET Idenity

☆樱花仙子☆ 提交于 2019-12-14 04:27:21
问题 I am developing a simple application using ASP.NET MVC 5 and the Identity API. I would like to ask how I am able to create a Super Administrator account inside a Super Administrators role upon creation of the tables and startup of the application. I am using the default ASP.NET MVC 5 with Individual Accounts template of Visual Studio 2013 and I am not sure how to do what I aim. 回答1: Never mind, I found this useful link that shows exactly what I want: https://github.com/rustd

Identity server 4 with asp.net identity registration

亡梦爱人 提交于 2019-12-14 03:11:31
问题 I want to know, how to correctly implement user registration in my identity server with asp net identity with redirection to login page after registration and then redirection to callback URL after login with registered account. I followed Identity Server 4 quickstart tutorial and as far i created my own mvc identity server with asp.net identity. Now i want to add some registration so i created RegistrationController with Registration form and added Register button to login form. I have an

AddToRole() method doesn't result in db entry in ASP.NET Identity

两盒软妹~` 提交于 2019-12-14 01:26:42
问题 I'm using ASP.NET Identity in my ASP.NET MVC app. My problem occures while adding user to role. There isn't any exception, but as a result of um.AddToRole() no db entry is added to AspNetUserRoles table. My action method looks like that: public ActionResult GrantAdmin(string id) { ApplicationUser user = um.FindById(id); if (!rm.RoleExists("admin")) { rm.Create(new IdentityRole("admin")); } um.AddToRole(user.Id, "admin"); return View((object)user.UserName); } um is an object of UserManager

Get UserName by UserId and display in View

只谈情不闲聊 提交于 2019-12-13 22:15:10
问题 In an ASP.NET MVC 5 application how would I go about getting a Username from a given UserId and display it in a View ? Note - I do not need the Username of the current User . 回答1: Based on your comment, you are using ASP.Net Identity. I assume you already have ApplicationUserManager. For example, private ApplicationUserManager _userManager; protected ApplicationUserManager UserManager { get { return _userManager ?? (_userManager = HttpContext.GetOwinContext().GetUserManager

.AspNetCore.Correlation. state property not found. Unknown Location

此生再无相见时 提交于 2019-12-13 20:41:31
问题 I am using hybrid authentication flow with OIDC. options.Events.OnRedirectToIdentityProvider = redirectContext => { if (redirectContext.Request.Path.StartsWithSegments("/api")) { if (redirectContext.Response.StatusCode == (int)HttpStatusCode.OK) { AuthenticationProperties properties = new AuthenticationProperties(); properties.RedirectUri = redirectContext.ProtocolMessage.RedirectUri; redirectContext.ProtocolMessage.State = options.StateDataFormat.Protect(properties); redirectContext.Response

What generates the value of an int primary key for users with ASP.NET Identity 2?

流过昼夜 提交于 2019-12-13 20:33:42
问题 It's my understanding with ASP.NET Identity 2 you will be able to have a PK of int for Users and Roles. I like the idea of this very much. But currently ASP.NET Identity 1.0 seems to generate a GUID which is converted to a string. I understand how to change to the PK being an int but what else is needed. If my PK's are integers then will it create an integer ID for me automatically when I create a new user ? 回答1: EF by default knows how to generate int identities unlike Guids, so you shouldn

Where does a WebApi 2.0 project store new users (when created with individual user authentication)?

ぐ巨炮叔叔 提交于 2019-12-13 16:24:24
问题 I've created a solution consisting of an MVC 5 project and a WebAPI 2.0 project, with the MVC project set to use No authentication settings and the WebAPI project set to use individual users authentication settings. I've also added a reference of my WebAPI project to my MVC project and configured the solution to use the MVC project as it's startup- the button's in the navbar take me to the views returned to me by the MVC controllers, but when visiting /api/values I get the XML results back,

Populating SecurityStamp for legacy users in database in ASP.NET Identity

坚强是说给别人听的谎言 提交于 2019-12-13 14:39:32
问题 I have a legacy database that I am using with ASP.NET Identity. In order to use the Identity functions a SecurityStamp value is required in the database for each user. Some have mentioned in other questions relating to this that the value can be 'any random value, EG a random int' but that doesn't sound right to me!? I created a new user in the database using this code: IdentityResult result = await UserManager.CreateAsync(user, model.Password); and it populated it with the following value: