What is the order of execution in ASP.NET MVC Controller?

Posted by Xinxua on Stack Overflow See other posts from Stack Overflow or by Xinxua
Published on 2010-03-25T08:08:16Z Indexed on 2010/03/25 8:13 UTC
Read the original article Hit count: 416

Filed under:
|
|
|

Say I have a controller called "HomeController" which inherits from Mvc.Controller. Also say I have written the constructor of the controller and some filters for some actions.

Public Class ClientController
    Inherits System.Web.Mvc.Controller

    Public Sub New()
        ''Some code
    End Sub

    <SomeActionFilter()> _
    Function Index() As ActionResult
        Return View()
    End Function
End Class

My questions are :

  1. What is the order of execution of constructor, filter, action?
  2. Can I have a filter for the Constructor, if I do not want to run the code in it by checking for some conditions?

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about vb.net