Answer the question
In order to leave comments, you need to log in
ASP NET Identity - how to connect to a developed project?
I am developing my blog, I have already done some functionality, there are several tables in the database:
Articles
Categories
Pages.
For a DB the approach "First the Code" is used
Now I do futile attempts to fasten authorization.
I'm stuck at this moment.
I have 2 projects in VS - Domain and WebUI. In which is it more correct to implement ASP NET Identity?
And another question. I already have my own context for connecting to the database
, which is inherited from DbContext, and here I also need to create an AppIdentityDbContext, which should be inherited from IdentityDbContext<Т>public class EFDbContext : DbContext
public class AppIdentityDbContext : IdentityDbContext<AppUser>
Answer the question
In order to leave comments, you need to log in
If you need an example, create an empty project in Visual Studio based on the ASP.NET MVC template, with the authorization item marked (Individual User Accounts it's called). Also the context of connection to a DB will be created to you. In addition, the simplest logic of registration, authorization, password recovery, etc. is automatically implemented. - there will be a lot to see.
UPD: In the "Pro" version of Freeman's book on MVC 5, Identity is given special attention. If I'm not mistaken, almost 100 pages - I recommend taking a look as well. Pro ASP.NET MVC 5 Platform
Inherit your context from IdentityDbContext, not from DbContext and that's it, well, in the standard template, as Eugene said above, everything is there. And access is controlled by the [Authorize] attribute, you can mark both the action and the controller itself.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question