2
我有兩個意見,其中包括相同的登錄表單。表格調用相同的動作。我想在頁面中顯示錯誤。我重定向到indexpage。但是,當我從loginpage錯誤登錄時dispalyed在indexpage,但我想的錯誤loginpage顯示時,從登錄頁面和索引頁面登錄時從索引頁登錄如何從操作返回默認視圖?
我的代碼是
public ActionResult ValidateLogIn(UserLogin users)
{
if (ModelState.IsValid)
{
var result = _accountUserService.GetAccountUserByEmailId(users.Email);
if (result != null)
{
if (result.Password == users.Password && result.Active)
{
Session.Add("Username", result.Email);
ViewBag.email = users.Email;
return View("Index");
//return full form registration;
}
ViewBag.UError = NcMessage.NotAcitvated;
}
else
{
ViewBag.UError = NcMessage.UsernameNotFound;
}
}
return View("Index");
}
怎麼可能我做?