【发布时间】:2012-12-27 22:45:17
【问题描述】:
有没有办法告诉控制器动作是从哪个视图调用的? 例如,我想使用“ControllerContext.HttpContext.Request.PhysicalPath”,但它返回控制器操作本身所在的路径:
public ActionResult HandleCreateCustomer()
{
// Set up the customer
//..code here to setup the customer
//Check to see of the calling view is the BillingShipping view
if(ControllerContext.HttpContext.Request.PhysicalPath.Equals("~/Order/BillingShipping"))
{
//
return RedirectToAction("OrderReview", "Order", new { id = customerId });
}
else
{
return RedirectToAction("Index", "Home", new { id = customerId });
}
}
【问题讨论】:
标签: asp.net-mvc-3 view controller