Is OnActionExecuting thread-safe?

Viewed 46

I want to use userId field for checking user id in every action.
Is this approach thread-safe?

public class AccountController : Controller
{
    public override void OnActionExecuting(ActionExecutingContext context)
    {
        userId =  User.FindFirstValue(ClaimTypes.NameIdentifier); 
        path = $"{context.HttpContext.Request.Path.Value}[{context.HttpContext.Request.Method}]";
    }
}

If it not correct can you suggest me other ways to do that.

0 Answers
Related