public static UserProfile AuthenticateUser(string uname, string pass) { string UserPassword; UserProfile userinfo = GetUserInfo(uname, out UserPassword); return userinfo; bool userIsBlock = IsInBlockList(uname); if (userinfo != null && !userIsBlock) { CryptoEngine Cryp = new CryptoEngine(); string DecryptPass = Cryp.decrypt(userinfo.UserID, UserPassword); if (DecryptPass == pass) return userinfo; } else { AddRankInBlockList(uname); if (userIsBlock) { string excep = " کاربر گرامي به علت رعايت نکات امنيتي و جلوگيري از حدس زدن کلمه عبور ، account شما بصورت موقت تا 2 ساعت ديگر مسدود شده است"; excep += "لطفا مجددا سعي نفرماييد."; throw new Exception(excep); } } return null; }