asp.net-coreshared-hostingaspnetboilerplate.net-8.0libman

.NET 8 ASPBoilerplate Demo: CSS Stops Working After Login on Shared Hosting Deployment


I recently downloaded a demo of ASPBoilerplate using .NET 8, structured with MVC. Upon deploying it to shared hosting, an issue arises where the login page displays correctly with CSS styling. However, after logging in, all CSS styling ceases to function, resulting in a broken appearance resembling the attached screenshot.

Could anyone provide insights into why this CSS malfunction might occur specifically after login on shared hosting, despite functioning properly in other scenarios? Any suggestions or troubleshooting steps to rectify this issue would be greatly appreciated. Thank you.

enter image description here

enter image description here

I am deploying an application on shared hosting at mywindowshosting.com hosting provider. Deployment steps:

  1. Download the Publishsettings file from the hosting provider's website admin panel.
  2. Add it in the Publish process as Import Profile.
  3. The Target Profile is net5.0 and the Deployment Mode is self-contained. (The same as mentioned in aspnetboilerplate)
  4. The deployment process is a successfully deployed application but nowadays after login all CSS and JS files stop working.

I have also created a dummy login for the test. Website: https://life-easy.co.in/Account/Login Username: ismcagdas@abcd.com Password: Admin@123

One additional point to mention is that I've recently configured out-of-process settings. The rationale behind this decision is that I have a premium plan with 1 GB of RAM, and both applications use different versions of .NET Core. One application is using version 5.0, while the newer one is using version 8.0. Consequently, I've set them to run out of process. Would this have any impact on the current scenario?


Solution

  • Just looking at your site - on your Home view there's only 1 css loaded (see attached screenshot) and it's missing the layout css which is why your site looks broken.

    enter image description here

    So a few points for your consideration:

    1. Ensure that the stylesheets included in your master page use relative paths. Specify your stylesheet links with runat="server" and prefix them with the virtual web root path (~). For example:

    <link href="~/Styles/site.css" rel="stylesheet" type="text/css" media="screen" runat="server" />

    1. Inspect your CSS files for any syntax errors or issues. Sometimes a single error can prevent the entire stylesheet from being applied.

    2. Follow ASP.NET Boilerplate own conventions and structure. You might find this help page useful. https://aspnetboilerplate.com/Pages/Documents/Embedded-Resource-Files

    3. Check ASP.NET Boilerplate samples on Github. It may provide you with many insights. https://github.com/aspnetboilerplate