This Nuglet follows two Community Server Gold Forums issues on restricting access to CS Areas to registered users or to some specific role. I republished one of those Gold Forums threads in this Public Discussions Forum post. The other I'm Nuglifying here.
A Community Server admin managed a CS Site restricted to registered users only. These users receive URLs to files in the File Gallery in emails and so forth, and if not logged-in when trying to access the file they received the CS message, "Access Denied. You do not have permissions to perform the requested action." (Because access was restricted to registered users only, we couldn't use Set Everyone to View Only in the File Gallery.) The Admin wanted his users who were not logged-in when trying to access the file to be redirected to a login page instead of seeing the "Access Denied" message.
Restricting File Galleries by adding web.config authorization in the /files area provided this exact functionality. Not only was access restricted to registered users only, but the UrlRedirect page containing the url to the file was passed to the login page enabling immediate access to the file upon logging in. The web.config would look like this.
<configuration>
<system.web>
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>
</system.web>
</configuration>
W00tin' T00tin' Web Configin'!