/// <summary> /// Determines whether a user can take the poll or if the results must be shown. /// My implementation only allows authenticated users who have not already taken the poll to vote. /// EXTENSION POINT: If you want to modify what users can take the poll (such as allowing /// anonymous users), modify the CanUserTakePoll() method...) /// </summary> /// <returns>true if user can vote</returns> private bool CanUserTakePoll() { // Anonymous visitors cannot take poll if (!Request.IsAuthenticated) { return(false); } // Determine if this user has already taken this poll... if so, they cannot retake it. MembershipUser currentUser = Membership.GetUser(); if (currentUser != null) { if (currentUser.ProviderUserKey != null) { var userId = (int)currentUser.ProviderUserKey; return(Polls.CanUserTakePoll(PollId, userId)); } } return(false); }