I'm trying to call controller and a view from it dynamically, I'm retrieving controller name and view name from database, then I want to execute that as the view result of Page/Index url.
Basically I'm trying to do something like this:
public class PageController : Controller
{
public ActionResult Index()
{
var controllerName = // logic to get Controller name (already have)
var ViewName = // logic to get View name (already have)
Return View(ControllerName, ViewName); // I want to achieve this functionality without redirect
}
}
I have tried Server.TransferRequest
but that causes HttpContext.Items
to be cleared which I don't want it to happen, also I don't want to redirect, Is there any other way?