I have a base controller ApplicationControllerthat needs to grab the host url and do some processing before the child controllers are started. Since controller constructors run before RequestContext is initialized, I have to override the Initialize method to complete my processing.
ApplicationController:
Protected Overrides Sub Initialize(ByVal requestContext As System.Web.Routing.RequestContext)
MyBase.Initialize(requestContext)
Dim host as String
host = Request.Url.Host.ToString
End Sub
What is the logic behind locking controller constructors before the Initialize method?
Also what are the rules of what should be placed in the initialization method.
source
share