I have an ASP.NET application that uses the Roles.GetRolesForUser
method. The call work fines within the application, but when i use the same call in a referenced library, it throws an exception. The exception message is:
Object reference not set to an instance of an object
The strange things is that when i check Roles, it is instantiated.
My code looks like this:
var roles = Roles.GetRolesForUser(userName);
Any suggestions?
NOTE: according to the OP's comment himself, this answer solved his problem.
This is a .NET Framework bug.
To solve this issue call:
string[] roles = Roles.Provider.GetRolesForUser(userName);
here is a very similar question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With