Did you follow, Step 2: Specifying and Configuring the Roles Framework Provider and Step 3: Examining the Roles API ? Please ensure that your codebehind references System.Web.Security namespace.
Above steps make sure that all configuration are taken place to implement role-based authentication.
For more information, see this article which explains full configuration for roles impelementation.