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

101 views Asked by At

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: [email protected] 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?

2

There are 2 answers

2
woodykiddy On BEST ANSWER

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

0
Mahavirsinh Padhiyar On

Issue with Missing shared-layout.min.css in aspnetboilerplate Bundle Configuration

After multiple build or release processes, it's been observed that the shared-layout.min.css file, crucial for bundling, is not consistently generated. This inconsistency may result in the absence of the shared-layout.min.css file within the designated _Bundle folder, as specified in the _bundle_config.json file. Consequently, manual intervention becomes necessary to include the minified version of this file.

To address this issue, it's imperative to ensure that the _shared_layout.css file is consistently generated and included within the bundle during build or release processes. This can be achieved through various means, such as reviewing the build configuration settings, ensuring proper file dependencies are accounted for, and verifying the bundling process to guarantee the inclusion of all necessary files.

In cases where manual intervention remains necessary, developers should ensure that the minified version of the _shared_layout.css file is correctly included within the bundle folder, adhering to the established project conventions and file naming conventions.

If this issue persists despite efforts to rectify it, it may be beneficial to consult the aspnetboilerplate community or seek assistance from experienced developers familiar with bundle configurations and build processes in ASP.NET applications.

The same discussion is also available on Github can refer Github Issue