Is there any difference between:
public ActionResult logOff()
{
FormsAuth.SignOut();
return RedirectToAction("index", "Home");
}
And:
public ActionResult logOff()
{
FormsAuth.SignOut();
return index();
}
Yes.
With RedirectToAction()
your users will be redirected to Index page (that's what they'll see on the browser address bar). Simply returning the result of your index()
method instead will fill the current page (LogOff
?) with the content of the other page.
In this case maybe there is no difference but if your action performs some logic then you may have problems when users simply refresh the page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With