asp.net mvc get controller name and action name

zyip發表於2014-01-06

@{
var controller = @HttpContext.Current.Request.RequestContext.RouteData.Values["controller"].ToString();
var action = ViewContext.Controller.ValueProvider.GetValue("action").RawValue;

}

相關文章