我有MVC4应用程序,其中包含http-handler,我想将用户重定向到我的第一页
控制器
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
}
HttpHandler的
public class MyPublicHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
if (condition)
{
var controller = new HomeController();
controller.Index(); // redirect and execute
}
// or something like that
if (condition)
{
ExecutePage("http://myWebSite/Home/Index")
}
}
}
谢谢!