2

I am developing an ASP.NET MVC 5 web application using SQL Server with stored procedures.

In a defined case, I am trying to redirect the user in to a specific section of the page and not the top of page but I didn't succeed.

This is what I've tried :

Controller :

else 
{ 
    TempData["msg2"] = " Please verify your data !";
    return RedirectToAction("Index" + "/" + "#login", "Home");
}

The view : (Index)

<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>
            }

The URL that I get is here :

http://localhost:60585/(S(mnraq5fizd2wkqbg5pjpr5qu))/Home/Index/%23login#2249506
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Exact
  • 269
  • 6
  • 18
  • Possible duplicate of [ASP.Net MVC RedirectToAction with anchor](https://stackoverflow.com/questions/602788/asp-net-mvc-redirecttoaction-with-anchor) – Fran Dec 12 '17 at 14:35
  • I read the post you mention it before I created this question but it didn't help me, that's I asked it again, Best regards – Exact Dec 12 '17 at 14:37
  • Maybe it can be done with JS? when the page loads, scroll it to the section you want. :| – Sudeep Shrestha Dec 27 '17 at 17:49

0 Answers0