1.
У меня есть домашняя страница (Home / Index). Здесь вы выбираете язык.
Вот URL-адрес: "localhost:xxxx".
2.
После выбора языка, следующая страница входа (учетная запись / индекс)
Вот URL-адрес: "localhost:xxxx/Account/Index?language=en-US".
3.
При вводе данных (имя пользователя / пароль) и нажатии кнопки входа в систему происходит перенаправление на пользователя / индекс, но URL остается в учетной записи / входе
Моя форма:
<% using (Html.BeginForm("LogOn", "Account")) { %>
<div data-role="fieldcontain" class="ui-hide-label">
<label for="username">Username:</label>
<%: Html.TextBoxFor(m => m.Username, new { placeholder = "Username" })%>
</div>
<div data-role="fieldcontain" class="ui-hide-label">
<label for="password">Password:</label>
<%: Html.PasswordFor(m => m.Password, new { placeholder = "Password" })%>
</div>
<fieldset class="ui-grid-a">
<div class="ui-block-a"><button type="reset" data-theme="d">Reset</button></div>
<div class="ui-block-b"><button type="submit" data-theme="b">Log On</button></div>
</fieldset>
<% } %>
Контроллер аккаунта:
[HandleError]
public class AccountController : Controller
{
public ActionResult Index(string language = "es-Es")
{
return View();
}
[HttpPost]
public ActionResult LogOn(UserModel user)
{
FormsAuthentication.SetAuthCookie(user.Username, false);
return RedirectToAction("Index", "User");
}
public ActionResult LogOff()
{
return View();
}
}
Global.asax:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
Как сделать так, чтобы URL был: localhost: xxxx / User / Index?