404 Not Found Glyphicons Bootstrap Work Around - css

Is it possible to get bootstrap glyphicons to work without adding this code to web.config?
<system.webServer>
<staticContent>
<remove fileExtension=".woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff" />
</staticContent>
</system.webServer>
Unfortunately I am unable to add this at my workplace but would still like to use the pagination from bootstrap. Is there any other way around this? These are the errors I am receiving.
Maybe somehow download the images directly and change the bootstrap css to find the correct ones? All I need is the pagination ones at the moment. Any ideas?

Try going to the file's address and fix it from there. If it's not there too then just use a CDN: Bootstrap CDN | MaxCDN

You might be able to:
Use Bootstrap hosted on a CDN
Build or modify bootstrap and remove the woff fonts
A combination of the two, modify your own Bootstrap to use woff files from a CDN
Rewrite the glyphicon part of Bootstrap to use images (probably the worst idea, but it would work).

You should be able to use bootstrap pagination even if glyphicons-halflings-regular.woff2 or glyphicons-halflings-regular.woff cant be found.
Bootstrap is coming with glyphicons-halflings-regular.ttf by default. The browser will use the first compatible font file that it will found and ttf is well supported.
For more information: Why should we include ttf, eot, woff, svg,... in a font-face
Maybe something is wrong in your html.

Related

IIS Express won't download .coffee files

I just enabled source maps because, sure why not, I'd like to try them out. However, I'm finding that IISExpress will not download .coffee files so it doesn't work.
I'm sure it's a simple web.config modification, I'm just not sure which one. How do I configure it to serve these?
All of IIS Express's configuration is done through the configuration files; in this case you want
C:\Users\[user]\Documents\IISExpress\config\applicationhost.config
In that file, there's a list of all of the static content types that IIS Express knows about and is willing to serve. You just need to add your extension to that list. The list starts about 1/2 down the file, in this XML element:
<staticContent lockAttributes="isDocFooterFileName">
It should be pretty obvious what to do from there: just map.coffee files to the correct mime type.
<mimeMap fileExtension=".coffee" mimeType="text/plain" />
This element is found within the system.webServer element, which is one of the ones that supports delegation to individual web.config files, so you should be able to add a similar XML block to your project's configuration file:
<system.webServer>
<staticContent>
<mimeMap fileExtension=".coffee" mimeType="text/plain" />
</staticContent>
</system.webServer>

Possible to add MIME type to web.config without possibly breaking the site?

I had a web.config in one of the websites on my IIS that was adding a support for .7z file extension. When I later added a global .7z support at the server level, this site was broken - IIS Manager is complaining that it "cannot add duplicate collection entry of type 'mimeMap'..." and all web requests to i.g. CSS files ended with an HTTP 500 error.
I was using this in the site's web.config:
<system.webServer>
<staticContent>
<mimeMap fileExtension=".7z" mimeType="application/x-7z-compressed" />
</staticContent>
</system.webServer>
Is there maybe some other syntax that would add 7z to the list only if it wasn't defined yet?
According to this, you should remove the global setting in the special config before adding it in a different form.
Explcitly:
<system.webServer>
<staticContent>
<remove fileExtension=".7z" />
<mimeMap fileExtension=".7z" mimeType="application/x-7z-compressed" />
</staticContent>
</system.webServer>
Of course this doesn't really help you now as you might just as well drop the local setting completely (as it's likely to coincide with the global setting). But if you had known this back when you added local 7zip support, you wouldn't have encountered the error now ...

Add MIME mapping in web.config for IIS Express

I need to add a new MIME mapping for .woff file extensions to IIS Express.
If I add the following snippet to the "applicationhost.config" of IIS Express it works fine:
<staticContent lockAttributes="isDocFooterFileName">
<mimeMap fileExtension=".woff" mimeType="font/x-woff" />
...
But I would actually like to do add it to my "web.config" so that not every developer would need to change their "applicationhost.config" locally.
So I removed it again from the "applicationhost.config" file and added the following snippet to the project's "web.config":
<system.webServer>
...
<staticContent>
<mimeMap fileExtension=".woff" mimeType="font/x-woff" />
</staticContent>
</system.webServer>
Unfortunately it doesn't seem to work that way because when I try to access a .woff file I end up with a HTTP 404.3 error.
What am I doing wrong?
Putting it in the "web.config" works fine. The problem was that I got the MIME type wrong. Instead of font/x-woff or font/x-font-woff it must be application/font-woff:
<system.webServer>
...
<staticContent>
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
</staticContent>
</system.webServer>
See also this answer regarding the MIME type: https://stackoverflow.com/a/5142316/135441
Update 4/10/2013
Spec is now a recommendation and the MIME type is officially: application/font-woff
If anybody encounters this with errors like
Error: cannot add duplicate collection entry of type ‘mimeMap’ with unique key attribute
and/or other scripts stop working when doing this fix, it might help to remove it first like this:
<staticContent>
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
</staticContent>
At least that solved my problem
<system.webServer>
<staticContent>
<remove fileExtension=".woff"/>
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="font/woff2" />
</staticContent>
</system.webServer>
I know this is an old question, but...
I was just noticing my instance of IISExpress wasn't serving woff files, so I wen't searching (Found this) and then found:
http://www.tomasmcguinness.com/2011/07/06/adding-support-for-svg-to-iis-express/
I suppose my install has support for SVG since I haven't had issue with that. But the instructions are trivially modifiable for woff:
Open a console application with administrator privilages.
Navigation to the IIS Express directory. This lives under Program Files or Program Files (x86)
Run the command:
appcmd set config /section:staticContent /+[fileExtension='woff',mimeType='application/x-woff']
Solved my problem, and I didn't have to mess with some crummy config (like I had to to add support for the PUT and DELETE verbs). Yay!
Thanks for this post. I got this worked for using mustache templates in my asp.net mvc project
I used the following, and it worked for me.
<system.webServer>
<staticContent>
<mimeMap fileExtension=".mustache" mimeType="text/html"/>
</staticContent>
</system.WebServer>
I'm not using IIS Express but developing against my Local Full IIS 7.
So if anyone else get's here trying to do that, I had to add the mime type for woff
via IIS Manager
Mime Types >> Click Add link on right and then enter
Extension: .woff
MIME type: application/font-woff
To solve the problem, double-click the "MIME Types" configuration option while having IIS root node selected in the left panel and click "Add..." link in the Actions panel on the right. This will bring up the following dialog. Add .woff file extension and specify "application/x-font-woff" as the corresponding MIME type:
Follow same for woff2 with application/x-font-woff2
I was having a problem getting my ASP.NET 5.0/MVC 6 app to serve static binary file types or browse virtual directories. It looks like this is now done in Configure() at startup. See http://docs.asp.net/en/latest/fundamentals/static-files.html for a quick primer.

Less stylesheet file 406 on IIS7/discountaspnet

I have a site, http://www.allampersandall.com that i'm trying to post up to discountasp.net. It runs great locally in VS2010 debug, but when i post it up all my .less files HTTP 406.
When i looked up HTTP 406, it says its the browser not accepting it-- but why would it run locally but not up on live?
Any ideas?
Thanks,
I fixed this in the end....
The 406 error is basically telling you that there was a mismatch between what the browser was expecting and what the server sent it.
In my case it was the fact that my web.config was telling the browser that any files with an extension of .less were to be served as the mime type "text/css".
<staticContent>
<mimeMap fileExtension=".less" mimeType="text/css" />
</staticContent>
Where as, in my site, the file was being declared as "text/less"
<link href="#Url.Content("~/Content/style.less")" rel="stylesheet/less" type="text/less" />
To fix it I changed the "mimeType" setting in the web.config to match the declaration in the page so the web.config section is now:
<staticContent>
<mimeMap fileExtension=".less" mimeType="text/less" />
</staticContent>
I hope that helps!
Cheers

Web host does not support .less file extension

I am using lesscss.org's styles on my MVC application.
It works great, but unfortunately my web host does not support .less file extensions, neither will they add support.
Seeing though LessCSS makes use of JavaScript, surely there must be a way to rename my CSS file from site.less to site.css and change the JavaScript to make use of the .css extension instead of the .less extension.
Please note I am not using dotLess, and compiling prior to release is also not what I am looking for.
Finally got it working.
All i had to do is modify my web.config of my MVC web application and add the following:
<system.webServer>
...
<staticContent>
<mimeMap fileExtension=".less" mimeType="text/css" />
</staticContent>
</system.webServer>
I re-published the site to my hosting provider afrihost, and it wall worked perfectly.
The script appears to only be looking for the stylesheet/less rel. As far as I can tell, the file extension doesn't matter.
To clarify, renaming styles.less to styles.css and using the following code should work:
<link rel="stylesheet/less" type="text/css" href="styles.css">
<script src="less.js" type="text/javascript"></script>
Simply convert to css locally before you upload it.
$ lessc styles.less > styles.css
From the usage page:
http://lesscss.org/#-client-side-usage
You can pass -x for minification.

Resources