Last post Dec 28, 2020 03:03 PM by PatriceSc
Dec 28, 2020 02:10 PM|Shriram Sankaran|LINK
We are working on an ASP.NET Web Forms application using ASP.NET Membership for user related operations. When a user is created in the application, we add him to two roles, a main and a sub role, as per the below code snippet.
if (mainRoleName == "Test")
Rarely, we face an issue where the user gets added to the subRoleName but is not part of the mainRoleName. Is there any specific reason for this to happen and anyone faced similar issues like the one mentioned?
Dec 28, 2020 02:31 PM|mgebhard|LINK
You have to understand a forum cannot answer this question. The code you've shared uses variables for the role names; mainRoleName and subRoleName. The community has no idea how these role variables are set or if it is possible for the variable to contain
values that do not match roles in the database.
When I consider troubleshooting steps, I would look at either the mainRoleName does not equal "Test" or the subroleName does not exist in the database. I'm pretty sure the code will throw an exception if the role does not exist in the database. Do you
have proper exception handling enable and are not hiding exceptions? Are you logging error messages?
Dec 28, 2020 03:03 PM|PatriceSc|LINK
Or could it be that the role "Test" is later removed from this user but that the subRoleName is left?