Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Entity Framework take about 30 second to do login ?

$
0
0

Hi

i have and MVC site with API, every thing works fine - i use Code First From Database

but when i try login it's take about 30 second to do the login and i don't know why ??!!

i use this code to login (user enter his RepID - then in code get user email by RepID then login)

// POST: /Account/Login
        [HttpPost]
        [AllowAnonymous]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            // This doesn't count login failures towards account lockout
            // To enable password failures to trigger account lockout, change to shouldLockout: true
            string email = db.AspNetUsers.Where(i => i.RepID == model.RepID).FirstOrDefault().Email;

            SignInStatus result = await SignInManager.PasswordSignInAsync(email, model.Password, model.RememberMe, shouldLockout: false);
            switch (result)
            {
                case SignInStatus.Success:
                    return RedirectToLocal(returnUrl);
                case SignInStatus.LockedOut:
                    return View(viewName: "Lockout");
                case SignInStatus.RequiresVerification:
                    return RedirectToAction(actionName: "SendCode", routeValues: new { ReturnUrl = returnUrl, RememberMe = model.RememberMe });
                case SignInStatus.Failure:
                default:
                    ModelState.AddModelError(key: "", errorMessage: "Invalid login attempt.");
                    return View(model);
            }
        }

so please how can i make it done faster ?


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>