我正在使用带有存储过程的SQL Server开发ASP.NET MVC 5 Web应用程序。
在一个定义的案例中,我试图将用户重定向到页面的特定部分而不是页面顶部,但我没有成功。
这是我尝试过的:
控制器:
else
{
TempData["msg2"] = " Please verify your data !";
return RedirectToAction("Index" + "/" + "#login", "Home");
}
观点:(指数)
<div class="login" id="login">
<div class="main-w3l">
<div class="w3layouts-main" style="background-image:url('/template/web/images/bg3.jpg'); margin-top:50px;">
<h2>Login Now</h2>
@using (Html.BeginForm("Login", "Home", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<input value="E-MAIL" name="Email" type="email" required="" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'E-Mail';}" />
<input value="PASSWORD" name="Password" type="password" required="" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'password';}" />
<span><input type="checkbox" />Remember Me</span>
}
我得到的网址是:
http://localhost:60585/(S(mnraq5fizd2wkqbg5pjpr5qu))/Home/Index/%23login#2249506