Hi my code is working perfectly fine on my own machine and another VM. Now, i have deployed it on Azure VM (not by publishing but by simply copying and creating a virtual directory). Now when i try to login
public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
{
if (ModelState.IsValid)
{
try
{
System.Web.HttpContext.Current.Session["SchoolCode"] = model.SchoolCode;
logger.Debug("assigning school code [" + model.SchoolCode + "] to session, password: " + model.Password);
var user = await UserManager.FindAsync(model.Username, model.Password);
logger.Debug("is school code valid: ");
if (user != null && isSchoolCodeValid(model.SchoolCode))
{
await SignInAsync(user, model.RememberMe);
return RedirectToLocal(returnUrl);
}
else if(user == null)
{
ModelState.AddModelError("", "Invalid username or password.");
}
else
{
ModelState.AddModelError("", "Invalid School Code.");
}
}
catch (Exception e) {
logger.Error(e.Message);
}
}
// If we got this far, something failed, redisplay form
return View(model);
}
my log file only shows the first log and then nothing happens
2017-09-27 09:41:56,915 [16] DEBUG - assigning school code [sc002] to session
I am also using a different port (93) on iis because it gave me the error that two sites cannot run simultaneously on the same port
So, my issue was entirely different from what i thought it was.
Firstly, i had increased the logging but my iis was picking the cached version which was why i was unable to see the logs. After i was able to see the Error in logs, it said
String was not recognized as a valid Boolean
It took me quiet a while to realize this error was coming due to database aspnetusers table. I changed EmailConfirmed from 0 to False and that fixed the issue!