Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

URL is not being changed #754


User avatar
0
sampath created

I need to develop an intermediate view in between login page and the dash board (SPA).The new view will show the list of tenants (companies).I have created an action methods as shown below.But unfortunately when I click the "Login" button,the url is not being changed.It stays on the same url (<a class="postlink" href="http://localhost:6240/Account/Login">http://localhost:6240/Account/Login</a>).But when I check it with the debug all the methods are being fired without any issues. But url is not being changed.Could you tell me why ? Thanks.

Url should be : <a class="postlink" href="http://localhost:6240/Account/ComapnyLogin">http://localhost:6240/Account/ComapnyLogin</a>

Note : When I execute above url on the browser then the view is being shown correctly.But it is not working auto when user clicks the "Login" button.

Post method :

[HttpPost]
        [UnitOfWork]
        [DisableAuditing]
        public virtual ActionResult CompanyLogin(LoginViewModel loginModel, string returnUrl = "", string returnUrlHash = "")
        {
            CheckModelState();
            _unitOfWorkManager.Current.DisableFilter(AbpDataFilters.MayHaveTenant);

              return RedirectToAction("CompanyLogin");
         }

Get method :

[HttpGet]
        public ActionResult CompanyLogin()
        {
              return View("CompanyLogin");
        }

login.cshtml

<form class="login-form" action="@Url.Action("CompanyLogin")" method="post">

 <button type="submit" class="btn btn-success uppercase">@L("LogIn")</button>

</form>

2 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Check this: <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/master/src/MyCompanyName.AbpZeroTemplate.Web/Controllers/AccountController.cs#L147">https://github.com/aspnetzero/aspnet-ze ... er.cs#L147</a>

    Here, you can set any target url after login.

  • User Avatar
    0
    sampath created

    Yes,It works.Thanks a lot :)