I have published and deployed an ASP.NET MVC application that uses the Roles feature of ASP.NET authentication. On my development machine, Roles work fine – but on my server, to which I’ve transferred the build, the entire database (schema, data, and users), and with full permissions, Roles don’t work.
Here is the line where my code crashes:
var exists = Roles.RoleExists("Administrator");
For some reason, such Roles queries aren’t working, but System.Web.Security.Roles.Enabled returns true and System.Web.Security.Roles.Provider is set properly.
What gives?
I found the solution, and it turned out to be unrelated to ASP.NET. The problem, which I found in my SQL logs, was that my SQL user did not have the EXECUTE permission for the database. All it took was a simple query:
Thanks to everyone for their help.