[英]VB.NET LogOn Redirect Not Working
我有以下代碼:
//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
userRole的值輸出“Administrator”,我將它與“Administrator”進行比較,但是它沒有重定向到公司控制器,而是轉到“Home”。
我怎樣才能解決這個問題? 謝謝!
注意:我也試過這個,但它也沒有執行重定向:
If String.Compare(userRole, "Administrator") Then
嘗試if userRole = "Administrator" then
我認為這可能會解決你的問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.