0

enter image description hereI have an assignment that requires us to use a shared Layout, tag helpers, etc. The Razor code works fine on every page except for the confirmaccount page

Here is a page it is working fine on:

@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@model bit285_assignment1_naps.Models.User;
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="/naps.css" />
    <title>Login Page</title>
</head>
<body>
    <h1>Login</h1>
    <fieldset>
        <form>
            <div>
                <label>Username</label>
                <input value="ian@home.com" />
                <span>* required</span>
            </div>
            <div>
                <label>Password</label>
                <input type="password" value="bl-blue-Bansenauer" />
                <span>* required</span>
            </div>
            <div>
                <input type="button" value="Login" />
                <input type="button" value="Reset" />
            </div>
        </form>
    </fieldset>

</body>
</html>

And here is the problematic page:

@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@model bit285_assignment1_naps.Models.User;
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="/naps.css" />
    <title>Account Confirmation</title>
</head>
<body>
    <h1>New Account Created</h1>
    <fieldset>
        <form>
            <div>
                <label>FirstName</label>
                <span>Brian</span>
            </div>
            <div>
                <label>Last Name</label>
                <span>Bansenauer</span>
            </div>
            <div>
                <label>Program</label>
                <span>Web App Dev</span>
            </div>
            <div>
                <label>Username</label>
                <span>ian@home.com</span>
            </div>
            <div>
                <label>Password</label>
                <span>bl-blue-Bansenauer</span>
            </div>
            <div>
                <input type="button" onclick="location.href='/login.html';" value="Go to Login" />
                <input type="button" value="Reset" />
            </div>
        </form>
    </fieldset>

</body>
</html>

At the very least, on the latter, the VS is not recognizing it and the text is completely white.

The first file is login.cshtml, the second is confirmaccount.cshtml

I have no idea why the confirmaccount one is not working, the code @model/layout works fine for 5 other pages. Also, most of this code is premade by my instructor and not my original work.

  • Try exit from the VS, remove `obj`, `bin` and recompile the solution. – Jackdaw Jan 26 '22 at 04:19
  • If this doesn't help try to clear the `ComponentModelCache`: [https://stackoverflow.com/a/33612416/6630084 ](https://stackoverflow.com/a/33612416/6630084). Just select proper VS version onder the `%LOCALAPPDATA%\Microsoft\VisualStudio`. – Jackdaw Jan 26 '22 at 04:31

0 Answers0