views:

147

answers:

2

Hello, This is a weird one. Probably painfully obvious. :D

I have a View (let's call it View0.aspx) that posts a form to a controller action (let's call it Action1). Action1 runs and then returns RedirectToAction("Action2"), which in turn returns View("View2").

Running it in the debugger, everything looks great (Action2 breakpoint gets hit). The problem is, it never loads View2.aspx. View0.aspx stays there. I even see the HTTP request for the route that calls Action2, but View2 never loads. I don't even get a refresh Any ideas?

Source below:

[AcceptVerbs("POST")]
    public ActionResult Action1()
    {
       // Run action code

       return RedirectToAction("Action2");
    }

public ActionResult Action2()
    {
       // run action code

       return View("View2");
    }
A: 

"see the HTTP request for View2" - you mean for Action2? You can't request view in MVC. "View0.aspx stays there" - where "there"? Is it plain POST or AJAXified? If it's plain POST and you hit Action2 then browser did already left Action0 page and is going to display the new result - whatever it is. Even error will change the page. So what do you mean by "View0.aspx stays there" - no page refresh? Page refresh but with same View0 content? Are you sure that View0 and View2 look different?

queen3
A: 

Hi guys, I just found the issue. I was doing an Ajax post, which explains why it wasn't redirecting. I switched it over to a normal post and it worked. Also, I just noticed a few errors in my OP, which I'm about to fix. Sorry about the confusing post.

jchapa