Why is ASP.Net MVC (or CodeIgniter) not redirecting the internal controller?

ASP.Net MVC Controllers have several methods for managing forwarding to another controller or action. However, all of them cause client redirection with 302 and a new browser request.

Why is there no internal function to "call another controller action" without involving the client? I am pretty sure that the codeIgniter php framework also lacks this functionality.

The best reason I can come up with is that ultimately this is not necessary, since any code you want to call can be replaced with something in common, and in ASP.Net MVC, at least the operation can be quite expensive. But a lot of people ask about it , and it seems that in the end it will be convenience.

So ... a lot of smart people have developed this framework. There must be good reasons not to have this?

+5
source share
3 answers

In Codeigniter, you can specify custom routes and more to direct specific URLs to other controllers / actions, but I think you mean that in the middle of the controller function, jump to another?

- -, , , . - - . , , , , .

, , , :

, , , , , ,

MVC.

.

+4

, , ASP.NET MVC, - #, . , , :

:

public class SampleController : Controller
{
   public ActionResult Foo()
   {
      return View("foo");
   }

   public ActionResult ShowMeFoo()
   {
      return Foo();
   }
}

, , . URL- RPC , URL- . , .

+4

, REST, . , URL- . , URL-, , - . .

+2

All Articles