TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
2.1k
474k
ApplicationDbContext does not exist in current context?
Feb 24 2020 2:31 AM
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
Microsoft.Owin;
using
Microsoft.AspNet.Identity;
using
Microsoft.AspNet.Identity.Owin;
using
Microsoft.Owin.Security.Cookies;
using
Microsoft.Owin.Security.Google;
using
Owin;
using
eNtsaTrainingRegistration.Models;
namespace
eNtsaTrainingRegistration.App_Start
{
public
partial
class
Startup
{
public
void
ConfigureAuth(IAppBuilder app)
{
// configure the db context, user manager and signin manager to a single instance per request.
app.CreatePerOwinContext(ApplicationDbContext);
app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);
app.CreatePerOwinContext<ApplicationRoleManager>(ApplicationRoleManager.Create);
// Configure sign cookie.
app.UseCookieAuthentication(
new
CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath =
new
PathString(
"/login"
),
Provider =
new
CookieAuthenticationProvider
{
// Enables the application to validate the security stamp when the user logs in.
// This is a security feature which is used when you change a password or add an external login to your account.
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
validateInterval: TimeSpan.FromMinutes(30),
regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
}
});
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
// Enables app to temperorily store user information when they are verified.
app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));
// To remember when to login in.
app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);
}
}
}
Reply
Answers (
1
)
Gridview get next and previous cells values
How to get the selected row in listview asp.net c#