Export (0) Print
Expand All

Controller.OnActionExecuting Method

Called before the action method is invoked.

Namespace:  System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

Protected Overridable Sub OnActionExecuting ( _
	filterContext As ActionExecutingContext _
Dim filterContext As ActionExecutingContext 



Type: System.Web.Mvc.ActionExecutingContext

Information about the current request and action.

If this method is overridden in a derived Controller class, it will be called for every action method in the class. For more flexibility, derive a class from ActionFilterAttribute and override this method in the derived ActionFilterAttribute class.

The following example shows how to write trace information for the action name before the action method runs.

Protected Overloads Overrides Sub OnActionExecuting(ByVal ctx As ActionExecutingContext) 
    ctx.HttpContext.Trace.Write("Log: OnActionExecuting", "Calling " & ctx.ActionDescriptor.ActionName) 
End Sub
© 2014 Microsoft