Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET MVC - Call a controller Action from another controller action

I have a controller action which I would like to call another controller action.

Is this a valid thing to do. Is it possible?

like image 388
iasksillyquestions Avatar asked Jan 03 '09 13:01

iasksillyquestions


People also ask

How can call controller action from another controller in MVC?

var ctrl= new MyController(); ctrl. ControllerContext = ControllerContext; //call action return ctrl. Action();

Can we call a controller from another controller?

Yes, you can call a method of another controller. The controller is also a simple class.


1 Answers

Controller.RedirectToAction

like image 185
yfeldblum Avatar answered Sep 18 '22 13:09

yfeldblum