MVC: I have deployed my application, but CSS only works when I log in
The answer was to do with assigning permissions to the user IIS_IUSR to the folders in which the application is deployed. A colleague discovered this for me. I have to admit I am not sure why this is necessary but it fixed the problem.
CSS changes on MVC App not working
This is likely due to the bundling framework using bootstrap.css
in local/debug mode and bootstrap.min.css
when you deploy. The framework uses a set of conventions when determining which files to add to a bundle, one of which is to use the .min version of a file, if it exists, for release builds. This is probably what's biting you. You made the change in bootstrap.css but not in bootstrap.min.css.
Try deleting bootstrap.min.css
and re-deploying. This should force the frameworkt to minify and use the bootstrap.css
file that you modified.
CSS and Javascript and images in ASP.NET MVC 5 website won't display after deployment
Try this in your bundle config
BundleTable.EnableOptimizations = false;
CSS is not being applied after changes
Hit the Ctrl-F5 for reloading the page without using the cached contents
CSS not updated during debugging ASP.NET MVC application
Your browser is caching the css. If you force a refresh with F5 that should display any changes.
Why is my CSS bundling not working with a bin deployed MVC4 app?
The CSS and Script bundling should work regardless if .NET is running 4.0 or 4.5. I am running .NET 4.0 and it works fine for me. However in order to get the minification and bundling behavior to work your web.config must be set to not be running in debug mode.
<compilation debug="false" targetFramework="4.0">
Take this bundle for jQuery UI example in the _Layout.cshtml file.
@Styles.Render("~/Content/themes/base/css")
If I run with debug="true"
I get the following HTML.
<link href="/Content/themes/base/jquery.ui.core.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.resizable.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.selectable.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.accordion.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.autocomplete.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.button.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.dialog.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.slider.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.tabs.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.datepicker.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.progressbar.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.theme.css" rel="stylesheet"/>
But if I run with debug="false"
. I'll get this instead.
<link href="/Content/themes/base/css?v=myqT7npwmF2ABsuSaHqt8SCvK8UFWpRv7T4M8r3kiK01" rel="stylesheet"/>
This is a feature so you can easily debug problems with your Script and CSS files. I'm using the MVC4 RTM.
If you think it might be an MVC dependency problem, I'd recommend going into Nuget and removing all of your MVC related packages, and then search for the Microsoft.AspNet.Mvc
package and install it. I'm using the most recent version and it's coming up as v.4.0.20710.0. That should grab all the dependencies you need.
Also if you used to be using MVC3 and are now trying to use MVC4 you'll want to go into your web.config(s) and update their references to point to the 4.0 version of MVC. If you're not sure, you can always create a fresh MVC4 app and copy the web.config from there. Don't forget the web.config in your Views/Areas folders if you do.
UPDATE: I've found that what you need to have is the Nuget package Microsoft.AspNet.Web.Optimization
installed in your project. It's included by default in an MVC4 RTM app regardless if you specify the target framework as 4.5 or 4.0. This is the namespace that the bundling classes are included in, and doesn't appear to be dependent on the framework. I've deployed to a server that does not have 4.5 installed and it still works as expected for me. Just make sure the DLL gets deployed with the rest of your app.
CSS & JS files not rendered when deploy of ASP.Net MVC application on IIS 8 (Windows 8)
I solved the problem!
Thanks to Bundling & minification not applying css & js using Asp.net 4.0 C# !
All I had to do is to change in my bundleConfig.cs file the name from :
bundles.Add(new StyleBundle("~/Content/Theme").Include(
"~/Content/bootstrap.css",
"~/Content/bootstrap-theme.css",
"~/Content/Theme/css/bootstrap-admin-theme.css",
"~/Content/Theme/css/site.css"));
to
bundles.Add(new StyleBundle("~/Content/allcss").Include(
"~/Content/bootstrap.css",
"~/Content/bootstrap-theme.css",
"~/Content/Theme/style/bootstrap-admin-theme.css",
"~/Content/Theme/style/site.css"));
CSS not being used by my view model
the CSS link to Home.css (which is in the same folder
as my view) does not appear to be used.
The Views
folder is restricted direct access to from the clients. So you should not be putting any CSS, javascript or images files inside it. They should reside in your ~/Content
folder (or some other folder which is accessible from the clients). And then reference it like this:
<link href="~/Content/Home.css" rel="stylesheet" type="text/css"/>
As far as your first problem about ~/Content/Site.css
is concerned, the stylesheet might be cached by the browser. Try clearing the cache. If you are running your application in Release mode and enabled Bundles, ASP.NET MVC 4 will automatically emit a cache response header so that the static resources included in the bundle get cached in the browser.
Related Topics
CSS Zoom Not Blurry But Pixelated
Background Image in Styled Components React
Flexslider Fades But Will Not Slide
Zoomed-Out Sizing in Twitter Bootstrap
How to Resolve The CSS Warnings for Browser Specific Selectors in Bootstrap 3
Wicked_Pdf Stylesheet Not Working on Heroku
Using CSS Attribute Selectors to Target The Src of Background-Image
Less CSS - Setting Variable Within Mixin
Making a Row of Divs All Be The Same Height Using CSS
How to Specify a Div's Position as Absolute and Relative at The Same Time
How to Inherit Only One Element of CSS Shorthand
Why Does an Inline-Block Div Get Positioned Lower When It Has Content
Vertical Line with Dots in Ends and Between
CSS: Link and: Visited Pseudo-Classes - Are Web Browsers Adhering to The Spec
Empty Style (.CSS/.Scss) Files
Primefaces Datatable Selectcheckboxmenu Filter Formatting Issue