【问题标题】:The page isn’t redirecting properly when accessing Dashboard\Index page访问 Dashboard\Index 页面时页面未正确重定向
【发布时间】:2021-02-11 01:10:08
【问题描述】:

我无法在我的本地复制此问题,它只发生在我们的登台服务器中。下面是 Account 控制器中 Login 函数的代码:

public ActionResult Login(string returnUrl)
        {
            if (Request.IsAuthenticated)
            {
                if (User.IsInRole(Role.Customer))
                {
                    return RedirectToAction("Catalog", "Inventory");
                }
                else if (User.IsInRole(Role.Admin))
                {
                    return RedirectToAction("Dashboard", "Admin");
                }
                else
                {
                    return RedirectToAction("Index", "Dashboard");
                }
                
            }
            else
            {
                ViewBag.ReturnUrl = returnUrl;
                return View();
            }
        }

这仅在打开 Dashboard\Index 时发生,并且打开其他页面没有问题。发生这种情况时,我将附上网络的屏幕截图。它正在访问同一页面。

是否有可能是因为我在本地将其设置为 https,但在暂存时却是 http?

稍作改动后就变成了这个样子。错误:Admin/Error?w=Column 'UserId' 不属于表 Table。

【问题讨论】:

    标签: c# asp.net-mvc iis


    【解决方案1】:

    您应该注意您的编程语言、平台、操作系统和框架。我建议您学习如何使用 Wireshark 并了解 TCP/IP,以便分析您的网络传输并发现错误。

    您的状态码为 302,表示您的路径 Dashboard\Index 已被临时移动。确保将所有文件和目录放在正确的位置。

    【讨论】:

    • 我检查过了,文件在里面。
    猜你喜欢
    • 2017-01-18
    • 2011-08-11
    • 2018-06-08
    • 2013-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-28
    相关资源
    最近更新 更多