public bool ProcessLogin(string userId, string password){
// Use the account business logic layer to login
Account account = new Account();
AccountInfo myAccountInfo = account.SignIn(userId, password);
//If login is successful then store the state in session and redirect
if (myAccountInfo != null) {
HttpContext.Current.Session[ACCOUNT_KEY] = myAccountInfo;
// Determine where to redirect the user back too
// If they came in from the home page, take them to a similar page
if (FormsAuthentication.GetRedirectUrl(userId, false).EndsWith(URL_DEFAULT)) {
FormsAuthentication.SetAuthCookie(userId, false);
HttpContext.Current.Response.Redirect(URL_ACCOUNTSIGNIN, true);
}else{
// Take the customer back to where the came from
FormsAuthentication.SetAuthCookie(userId, false);
HttpContext.Current.Response.Redirect(FormsAuthentication.GetRedirectUrl(userId, false), true);
}
return true;
}else {
// Login has failed so return false
return false;
}
}