-2

I have MVC4 web app project and I want to use http://fortawesome.github.io/Font-Awesome/

I have font awesome folder inside Content directory and I have in my Layout file this

<link href="@Url.Content("~/Content/font-awesome-4.2.0/css/font-awesome.min.css")" rel="stylesheet" />

or this

<link href="~/Content/font-awesome-4.2.0/css/font-awesome.min.css" rel="stylesheet" />

and in debug it works but after uploading on iis server it does not work (edit: I mean it does not show the images), how can I implement that .css? I'm using Razor.

EDIT: I discover some weird behaviour. In debug mode with VS the IE load CSS fine.

After deploying on IIS the IE cannot load CSS. But Chrome does load CSS ! I check it on several PCs and delete history and cache, so now application users are using Chrome in access to that App :-P

halfer
  • 19,824
  • 17
  • 99
  • 186
Muflix
  • 6,192
  • 17
  • 77
  • 153
  • You need to elaborate on "after uploading on iis server it does not work". How does it not work? Does it throw an error, or render the wrong content, or no content at all? – danludwig Jan 08 '15 at 14:36
  • it dont display the fonts, no errors. – Muflix Jan 08 '15 at 14:38
  • Does it render a element in the markup? what is the href attribute that gets rendered on the server? – danludwig Jan 08 '15 at 14:38
  • It render Other .css file work. – Muflix Jan 08 '15 at 14:39
  • When you navigate to that file on the server, does it exist? If so, where in the markup are you applying fontawesome css styles? – danludwig Jan 08 '15 at 14:40
  • This post might help you: http://stackoverflow.com/questions/12081255/asp-net-mvc-framework-4-5-css-bundles-does-not-work-on-the-hosting – emerson.marini Jan 08 '15 at 14:45
  • Also this one: http://stackoverflow.com/questions/11985431/why-is-my-css-bundling-not-working-with-a-bin-deployed-mvc4-app – emerson.marini Jan 08 '15 at 14:45
  • danludwig: yes on the server the .css file does exist. About bundling.. this is mandatory (must have) function which i need to configure to load this type of .css ?! Its more complicated then my application itself :D – Muflix Jan 08 '15 at 15:12

2 Answers2

1

AppStart-> BundleConfig inside RegisterBundle() function add a new bundle

bundles.Add(new StyleBundle("~/Content/AwFontcss").Include("~/Content/font-awesome-4.2.0/css/font-awesome.min.css"));

then in your view just include this bundle.

 @Styles.Render("~/Content/AwFontcss")
Nikitesh
  • 1,287
  • 1
  • 17
  • 38
  • Hello, thank you but if i dont have BundleConfig in AppStart directory, should i create it manually ? – Muflix Jan 08 '15 at 14:48
  • How are the basic css loading then? you can create your own.. you have to register it in global.ascx – Nikitesh Jan 08 '15 at 14:58
  • I have only one simple Default.css which is loaded with attribute, i have no experience with bundling and im reading about it right know, its seems to me like elephant for my purpose but i dont know other way :P – Muflix Jan 08 '15 at 15:01
0

Your most certain problem is that your Font files is not deployed to the server. By default, the VS deploy doesn't include those files.

You can check the contents of your Content folder in the server... and if a file is missing... just manually copy it, .

Romias
  • 13,783
  • 7
  • 56
  • 85