开发者

If I have a before action filter, how to set properties so they are available in actions?

In my actions, I want to pre-load the User object and set some other properties, all BEFORE the action loads.

I know there are events where I can do this, but how will these objects that I set be made available in my controller's actions once the filter fires and execution is now开发者_JAVA技巧 at the action level?

example:

public actionresult SomeAction() { string username = this.CurrentUser.username;

}


public override OnActionExecuting( forgotthesignature filterContext )
{
    this.CurrentUser = whatever;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜