There are two methods in the Home controller:

public ViewResult FirstView () { return View(); } //... public ViewResult SecondView() { if(условие){ return View("FirstView"); } return View(); } 

It is assumed that if when trying to access the SecondView view a certain condition is met (validation), then the transition to the FirstSecond view occurs. The code works, BUT in the address bar of the browser after performing if we see localhost / Home / SecondView. Is it possible to make the address line to localhost / Home / FirstView to change when executing if?

    1 answer 1

    Solved the problem as follows:

    1. Changed the return type from ViewResult to ActionResult
    2. replaced the return View("FirstView"); on return RedirectToAction("Authorization");