문제

http://msdn.microsoft.com/en-us/library/system.web.http.filters.authorizationfilterattribute(v=vs.118).aspx

States

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Does this mean that the following would not be safe to use as a custom asp.net mvc authorization filter attribute because MyCustomRoles is an instance member?

public class MyAuthorizationFilterAttribute : AuthorizationFilterAttribute
{
    // authorized users
    public string MyCustomRoles { get; set; }

    // ...
}
도움이 되었습니까?

해결책

Assuming this attribute is set by the calling code:

[MyAuthorizationFilter(MyCustomRoles = "abc")]

then this property is safe to be used.

See this similar post of mine for more detailed explanation of cases where it is not safe.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top