0

I'm relatively new to ASP.NET, and I've been commissioned to build a web-based application. I've built the base of the app, but when having problems getting it to show on GoDaddy hosting, broke down and went back to a brand-new project.

After a few days, I finally got the website to load; but when it's loaded it doesn't display the styling. When in debugging, the site looks, and responds fine. The deployed website's navigation works, but it has no styling at all that I can see.

This is in debug:

This is in Debug

This is in production:

This is in production

I've contacted GoDaddy support when I read this solution to a similar problem, but GoDaddy has assured me that IIS is set to serve static content on the server.

My next step was to make sure that my CSS files were referenced correctly, and as far as I can see, they are. Below is my _layout.cshtml file with a link to the primary CSS file for the site:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - WebApplication9</title>
    <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
    <link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
    <link rel="stylesheet" href="~/WebApplication9.styles.css" asp-append-version="true" />
</head>
<body>
    <header>
        <nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
            <div class="container-fluid">
                <a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">WebApplication9</a>
                <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
                        aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
                    <ul class="navbar-nav flex-grow-1">
                        <li class="nav-item">
                            <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
                        </li>
                    </ul>
                    <partial name="_LoginPartial" />
                </div>
            </div>
        </nav>
    </header>
    <div class="container">
        <main role="main" class="pb-3">
            @RenderBody()
        </main>
    </div>

    <footer class="border-top footer text-muted">
        <div class="container">
            &copy; 2023 - WebApplication9 - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
        </div>
    </footer>
    <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" asp-append-version="true"></script>
    @await RenderSectionAsync("Scripts", required: false)
</body>
</html>
3
  • Did you had the change to check browser network trace? Could you please share your program.cs file? Its importnat to check hows our static file middleware was configured. – Commented Nov 24, 2023 at 10:02
  • I found the reason, had to hire someone to help me figure it out; but the problem had to do with GoDaddy not supporting .Net 8.0. I downgraded the project to .Net 7.0 and everything worked fine. Commented Dec 8, 2023 at 2:16
  • Glad to know that your issue has been resolved. Commented Dec 8, 2023 at 6:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.