public ActionResult LogOn(string returnUrl)
{
if (Request.IsAuthenticated)
{
return RedirectToAction(string.Empty, "home");
}
else
{
if (!string.IsNullOrWhiteSpace(returnUrl))
{
//http://localhost:666/en-us/account/logon?returnurl=%2fen-us%2fadminka
//..............
}
return View();
}
}
[HttpPost]
public ActionResult LogOn(LogOnViewModel model, string returnUrl)
{
if (ModelState.IsValid)
{
if (....)
{
//..............
if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/")
&& !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
return Redirect(returnUrl);
return RedirectToAction(string.Empty, "home");
}
else
{
//..............
}
}
return View(model);
}
In HttpPost LogOn returnUrl is always equals null, even if it was not null in HttpGet LogOn.
Why? How do I fix it?