C#C
C#2y ago
aesthetics

[ASP.NET] ArgumentNullException: Value cannot be null. (Parameter 'viewData')

Earlier I attempted to change my ASP.NET Core MVC application to use User instead of IdentityUser. After attempting to change it, I couldn't get it to work and changed it back to IdentityUser. Now when I log-in, I get a ArgumentNullException. (I inherited from IdentityUser when using User)

This is my Identity custom Login page
@page
@model LoginModel

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Login</title>
    <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="~/css/site.css" asp-append-version="true"/>
</head>
<body class="bg-login">
<div class="centered" id="main-border">
    <div class="text-center" style="padding-top: 50px">
        <img src="~/images/loginlogo.png" width="214" height="60">
    </div>
    <form method="post">
        <div class="centered" style="margin-top: 15px">
            <input asp-for="Input.Email" class="inputdesign form-control" type="text" placeholder="Email"/>
            <span asp-validation-for="Input.Email" class="text-danger"></span>
            <input asp-for="Input.Password" class="inputdesign form-control" type="password" placeholder="Password" style="margin-top: 10px"/>
            <span asp-validation-for="Input.Password" class="text-danger"></span>
        </div>
        <div class="centered" style="margin-top: 10px;">
            <button class="btn btn-outline-primary" type="submit" id="loginBtn">Log in</button>
        </div>
        <div class="centered" style="margin-top: 10px;">
            <span asp-validation-summary="All" class="text-danger"></span>
        </div>
    </form>
</div>
    <script src="~/lib/jquery/dist/jquery.min.js"></script>
    <script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
    <script src="~/js/site.js"></script>
</body>
</html>
image.png
Was this page helpful?