What kind () to override in ASP.NET MVC Controller?

Which View () method is the last to be called in System.Web.Mvc.Controller? Or should I redefine each of them? I would like to set some view data in my BaseController, which inherits from System.Web.Mvc.Controller.

Edit: I would like to store basic user data such as IsLoggedIn and BasicUserDetails {PermissionLevel, UserName, EmailAddress, UserId}

Is this the place to install it?

+3
source share
2 answers

There are two different implementations (in RC 1):

    protected internal virtual ViewResult View(string viewName, string masterName, object model) {

    protected internal virtual ViewResult View(IView view, object model) {

. , . , .

. , ASP.NET. , - Request.IsAuthenticated. , . .. . , , , - Windows, , OpenID ..

2. , ControllerBase , , , .

+3

, "" . :

  • OnActionExecuting -
  • OnActionExecuted - ,
  • OnResultExecuting - ActionResult
  • OnResultExecuted - ActionResult,

, ,

+8

Source: https://habr.com/ru/post/1702942/


All Articles