我正在为asp.net MVC创建一个自定义操作过滤器。
在OnActionExecuting()
方法中。
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
string userName = ?????// how can I get this?
}
我需要找出当前用户名(我使用的是表单身份验证)
在控制器中,我可以简单地执行User.Identity.Name
有没有办法在ActionFilter中获得用户名?
https://stackoverflow.com/questions/7825104
复制相似问题