コード例 #1
0
        public override bool IsInRole(string role)
        {
            Sid  sid = null;
            bool ret = false;

            try
            {
                sid = GetSid(role);
                if (sid != null && sid.Value != IntPtr.Zero)
                {
                    ret = IsSidInToken(((WindowsIdentity)base.Identity).Token, sid);
                }
            }
            catch { /*Don't allow exceptions to bubble back up*/ }
            finally
            {
                if (sid != null)
                {
                    sid.Dispose();
                }
            }

            return(ret);
        }