1

I have simple form for Login page. However it is giving me error saying Request doesnt exist in that context. How do I fix it?

model Phishing.Models.PersonClass
    

    @using (Html.BeginForm("Login", "Home", new { ReturnUrl = Request.QueryString["ReturnUrl"] }, FormMethod.Post))
    {

        <input type="text" autocomplete="off" placeholder="username" name="UserName" />
        <input type="text" autocomplete="off" placeholder="password" name="Password" />
        <button type="submit">Log in</button>
    }

data
  • 55
  • 2
  • 8

1 Answers1

1

In .NET Core you have to use Query object from Context.Request path. So it would be:

Context.Request.Query["ReturnUrl"]

look at: How to get query string parameter from MVC Razor markup?

Kiksen
  • 1,559
  • 1
  • 18
  • 41