6

Is it possible to redirect to from one controller(A) action to another controller(B) action without changing URL?

I tried using RedirectToAction but URL in the browser changes

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Mag
  • 179
  • 1
  • 3
  • 6
  • What are you trying to do? – Andrew Oct 02 '13 at 19:35
  • 3
    Perhaps this is what you need http://stackoverflow.com/questions/799511/how-to-simulate-server-transfer-in-asp-net-mvc – TGH Oct 02 '13 at 19:39
  • 2
    This doesn't make any sense. If you're dealing with two separate controllers, you're dealing with two separate URLs. That's how routing works. If two different actions in two different controllers can respond to the same exact URL, then how in the world would MVC know which to route to? And, while you may be able to hack a solution like the comment above suggests, let's not forget the *whole entire point* of the redirect in the GET-POST-Redirect cycle: prevent reposts. If you're going to use the same URL, just don't redirect. – Chris Pratt Oct 02 '13 at 20:08

1 Answers1

2

Here you go, this ought to do it if I'm understanding you correctly.

How to simulate Server.Transfer in ASP.NET MVC?

Community
  • 1
  • 1
John Wu
  • 50,556
  • 8
  • 44
  • 80