I have simple login page like this:

Login.cshtml

```html
@page
@model GDPR.Views.Account.LoginModel
@{
}

@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

<html>
<body>
    <p>Login </p>
    <form method="post">
        <div asp-validation-summary="All"></div>
        Username: <input asp-for="loginData.Username" value="username" /><br />
        Password: <input asp-for="loginData.Password" value="password" /><br />
        <br />
        <input type="submit" value="Login" />
        @Html.AntiForgeryToken()
    </form>
</body>
</html>
```

and code behind:

```
public class LoginModel : PageModel
{
    [BindProperty] // Bind on Post
    public LoginData loginData { get; set; }

    public async Task<IActionResult> OnPostAsync()
    {
        if (ModelState.IsValid)
        {
          .......
            await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal);
            return RedirectToPage("/Home/Index");
        }
        else
        {
            ModelState.AddModelError("", "username or password is blank");
            return Page();
        }
    }

    public class LoginData
    {
        [Required]
        public string Username { get; set; }

        [Required, DataType(DataType.Password)]
        public string Password { get; set; }
    }
}

```

When I run the app I get an error: ArgumentNullException value cannot be null, param name : viewData.

[![enter image description here](https://i.stack.imgur.com/meCr1.jpg)](https://i.stack.imgur.com/meCr1.jpg)

What could be the reason for that error?