-5

Basically what the title says. It even hits the breakpoint on the targeted action method and debugs through the cshtml file. But it doesn't seem to do anything with the website. Though the network tab of chrome dev tool, retrieves the Survey page and has a status of 200.

return RedirectToAction("Survey");

Edit for clarity

I have a CreateSurvey view which submits and triggers my POST action method. In the POST action method it goes through the statement.

return RedirectToAction("Survey");

and hits the breakpoint of the Survey HttpGet action method and its corresponding view, but when I tab back to my site I didn't redirect. When I check the network tab in my chrome dev tools. The browser receives the Survey page request with a status of 200 but is still in the CreateSurvey page.

enter image description here

Cœur
  • 37,241
  • 25
  • 195
  • 267
Jc Balantakbo
  • 115
  • 1
  • 8
  • `"retrieves the Survey page and has a status of 200"` - Then what's the problem? What isn't working? You've described what a redirect does, it tells the browser to issue a GET to the target page. So what are you asking? – David Aug 03 '17 at 12:45
  • `But it doesn't seem to do anything with the website.` Talk us through what you mean by that. – mjwills Aug 03 '17 at 12:49
  • Can you show us a screenshot of the network tab, including the 302 to `Survey`? – mjwills Aug 03 '17 at 12:50
  • Your downvotes hurt :( . – Jc Balantakbo Aug 03 '17 at 12:58
  • 5
    The screen shot implies that `jQuery` is making the request? And `xhr`? How are you actually making this request? If you're using AJAX then that would explain why your page isn't reloading. AJAX is specifically used *not* to reload the page. – David Aug 03 '17 at 12:59
  • @JcBalantakbo: Much of the downvoting is likely due to the fact that in the original version of the question you basically said that you don't have time to explain the problem. That's... not really constructive. I edited that part out for you, but some of the damage was likely already done. – David Aug 03 '17 at 13:00
  • Sorry, just to briefly describe the problem. I am still on the createsurvey page though I receive the survey page which it should expectedly redirect to. – Jc Balantakbo Aug 03 '17 at 13:02
  • Looking into your answer @David. It does make a request through ajax. I susect that you are right. :( – Jc Balantakbo Aug 03 '17 at 13:09

1 Answers1

1

According to your screenshot these requests are being made via AJAX. AJAX is specifically used not to reload the page. And, as such, it won't automatically follow redirects or update the browser UI in any meaningful way.

Either don't use AJAX for the request (since you want the page context to reload anyway), or you can use AJAX and issue your redirect in client-side code upon completion of the request.

David
  • 208,112
  • 36
  • 198
  • 279
  • Thankx David. Mercy on the down votes guys. I have already edited my question for clarity. I don't really care about some virtual points in the interwebs but I would like to keep my questioning privileges. – Jc Balantakbo Aug 03 '17 at 13:17