Is it possible to change the URL when returning the View at the same time? Is this without redirection?

In ASP.NET MVC, I have a controller that looks something like this:

public class MyController{
    public ActionResult Index(){
        return View(new MyModel());
    }
    [HttpPost]
    public ActionResult Index(MyModel model){
        //do something
        return View("RegistrationConfirmation", new ConfirmModel());
    }
    [HttpPost]
    public ActionResult RegistrationConfirmation(ConfirmModel model){
        //do something else
        return View();
    }
}

The user workflow I would like to have is as follows

  • GETpage index. Returns the view Index. URL:~/My
  • POSTdata from the index page - returns the view RegistrationConfirmationand sends the user to the right page ~/My/RegistrationConfirmation.
  • User POSTother data on the page RegistrationConfirmationto be RegistrationConfirmationcalled for their processing.

At the moment, the action method is RegistrationConfirmationnever called, because after the RegistrationConfirmationview returns according to the action method, the URL remains ~/My, so the second position is Index(MyModel)not processed by the method RegistrationConfirmation(ConfirmModel).

URL- , , , POST ? , , ?


. 20 , , , , . , . , , , .

+5
1

RegistationConfirmation

, Html.BeginnForm...

   <% using(Html.BeginForm("RegistrationConfirmation", "MyController")){%>

    //form elements

   <%}%>

,

+2

All Articles