asp.net mvc bundles do not render for https.
here is my code:
bundles.Add(new StyleBundle("~/Content/css/css").Include("~/Content/css/custom.css"));
View
@Styles.Render("~/Content/css/css")
And the error code I get is:
Mixed Content: The page at
'https://domain/'
was loaded over HTTPS, but requested an insecure stylesheet'http://domain:443/Content/css/custom.css'
. This request has been blocked; the content must be served over HTTPS.
Do you have ~/Content/css/css as a real path in your app?
IIS is probably trying to handle the request.
Rename your bundle or the folder in your app and it should work.
So try this:
Then in your view:
The style bundle name can be anything you want, it doesn't have to be related to the real location of your CSS file.
Update
If you are getting mixed content errors, that's because some of your content is coming over HTTPS and other content is coming over HTTP.
The best way to overcome this problem is use // on all your content.
So say for example you have an image like this
change it too
That should stop your mixed content warnings.