I have the following code:
//redirect based on whether the user is admin, company owner, or blog owner
Dim userRole As String = Roles.GetRolesForUser(Membership.GetUser.UserName)(0)
Debug.Print(userRole)
If userRole Is "Administrator" Then
Return RedirectToAction("Index", "Company")
Else
Return RedirectToAction("Index", "Home")
End If
The value for userRole outputs “Administrator” and I am comparing it to “Administrator” however it’s not redirecting to the Company controller, instead it’s going to “Home.”
How can I fix this? Thank you!
Note: I also tried this, but it also doesn’t execute the redirect:
If String.Compare(userRole, "Administrator") Then
try
if userRole = "Administrator" theninstead I think that might solve you issue.