Is there any difference between:
public ActionResult logOff()
{
FormsAuth.SignOut();
return RedirectToAction("index", "Home");
}
And:
public ActionResult logOff()
{
FormsAuth.SignOut();
return index();
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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 yourindex()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.