ASP MVC 应用程序未重定向到指定的操作方法

ASP MVC application not redirect to specifed Action Method

我的登录控制器看起来像这样。

public class LogInController : Controller
{
    SchedulerContext schedulerContext = new SchedulerContext();

    [HttpGet]

    public ActionResult LogIn()
    {
        return View();
    }

    [HttpPost]
    public ActionResult LogIn(FormCollection frmCollection)
    {
        //Some Code

        return RedirectToAction("LogIn", "LogIn");
    }


    [HttpPost]
    public ActionResult SignUp(FormCollection frmCollection)
    {
        //Some Code

        return RedirectToAction("SignUpWizard", "SignUpWizard");
    }

}

我的登录控制器看起来像这样。

namespace Scheduler.Controllers.UserPanel
{
    public class SignUpWizardController : Controller
    {
        public ActionResult SignUpWizard()
        {
            return View();
        }
    }
}

我的视图是这样的。

@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <title>Login</title>
    <link href="~/Content/css/main.css" rel="stylesheet" />
    <link href="~/Content/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <script src="~/Content/js/jquery.js"></script>
</head>
<body>
    <nav class="navbar navbar-custom" role="navigation">
        <div class="container-fluid">
            <h2 class="text-center t-size-change">Login</h2>
        </div>
        <!-- /.container-fluid -->
    </nav>
    <div class="container m-t-150">
        <div class="row">
            <div class="col-md-12">
                <div class="login-tabs">
                    <!-- Nav tabs -->
                    <ul class="nav nav-tabs nav-justified nav-tabs-custom" role="tablist">
                        <li class="active"><a href="#home" role="tab" data-toggle="tab">Login</a></li>
                        <li><a href="#profile" role="tab" data-toggle="tab">Sign up for free</a></li>
                    </ul>
                    <!-- Tab panes -->
                    <div class="tab-content">
                        <div class="tab-pane active custom-tab" id="home">
                            @using (Html.BeginForm("LogIn", "LogIn", FormMethod.Post))
                            {
                                <div class="row">
                                    <div class="col-lg-12">
                                        <div class="form-group">
                                            <input type="email" placeholder="Email Address" class="form-control" name="Email" required>
                                        </div>
                                        <div class="form-group">
                                            <input type="password" placeholder="Password" class="form-control" name="Password" required>
                                        </div>
                                        <input type="submit" value="Login to Tucan Rotas" class="btn btn-success btn-custom" />
                                        <p class="text-center p-10"><a href="#">Forgot your password?</a></p>
                                    </div>
                                </div>
                            }
                        </div>
                        <div class="tab-pane custom-tab" id="profile">
                            @using (Html.BeginForm("SignUp", "LogIn", FormMethod.Post))
                            {
                                <div class="row">
                                    <div class="col-lg-12">
                                        <div class="form-group">
                                            <input type="email" placeholder="Email Address" class="form-control" name="Email" required>
                                        </div>
                                        <div class="form-group">
                                            <input type="password" placeholder="Password" class="form-control" name="Password" required>
                                        </div>
                                        <input type="submit" class="btn btn-success btn-custom" value="Sign up for free" />
                                    </div>
                                </div>
                            }
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="~/Content/plugins/bootstrap/js/bootstrap.min.js"></script>
    <script src="~/Content/js/tab.js" type="text/javascript"></script>
</body>
</html>

当我按下登录或注册按钮时,应用程序调用 LogIn() 方法装饰 具有 HttpGet 属性。

当我的应用程序启动时URL看起来像这样。

http://localhost:56789/LogIn/LogIn?ReturnUrl=%2f

现在我尝试将 URL 更改为

http://localhost:56789/SignUpWizard/SignUpWizard

当我按下 Enter 时,浏览器将应用程序重定向到 SignUpWizard 控制器并调用操作方法 SignUpWizard,但是 URL 自动更改为

http://localhost:56789/LogIn/LogIn?ReturnUrl=%2fSignUpWizard%2fSignUpWizard

请注意,除了 HttpGet 或 HttpPost 之外,我没有使用任何其他属性来装饰方法。我没有使用任何身份验证或授权。也尝试使用 AJAX.BeginForm() 以及 JQuery AJAX 调用来提交日期。我无法解决问题。

昨天相同的应用程序使用相同的代码正常工作。

  1. 首先我停止了IIS服务。
  2. 应用程序是否包含任何身份验证或授权代码?如果是,则将其删除。
  3. 删除 Bin 目录。
  4. 再次启动 IIS 服务。
  5. 运行再次申请