RedirectToAction Is not working

i am trying to redirect to Another Controller view from another controller. so l call the action method like

return RedirectToAction("Index","Orders");

But it giving error the path is not found.

Actuall problem is it is not regulat MVC project we made it in MVC Structure developed like

In folder developing the Project for each and every Module we creating the folder in the root folder and copied the controller, Model and views to the new folder

Area –> Orders –>Controller –>OrdersController

Area –>Orders –>views –>Orders –>Index

so i want to call this Index method from another controller

Area  –> Admin –>Controller –>AdminController

Area –>Admin –>Controller–>AdminController –> ReturnToOrders

From this method i want to redirect to Orders Page how can it be possible

Pass area as the third paratmeter (i.e., routeValues param) for RedirectToAction method.

A side note: If it has been to other controller action which is not in area, then we need to pass empty string instead of Orders.

return RedirectToAction("Index", "Orders", new { area = "Orders" }

References:

http://stackoverflow.com/questions/1391887/redirecttoaction-between-areas

http://stackoverflow.com/questions/10785245/redirect-to-action-in-another-controller

Leave a Reply