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
尝试if userRole = "Administrator" then
我认为这可能会解决你的问题。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.