How to move bootstrap fonts to different folder? - asp.net-mvc

I have a standard ASP.NET MVC application with Bootstrap. I moved the "Fonts" folder to "Content/Fonts". Inside the folder there are those glyphicons-halflings-regular files.
When I start the application I get a 404 browser error that the Fonts/glyphicons-halflings-regular.woff and glyphicons-halflings-regular.ttf file couldn't be found.
How do I configure my project so these files are found?

Solution was to update pathes in my bootstrap.css.
(See comments of original question)
Thx meep for your help.

One solution is to update paths in bootstrap.css. However, when you update Bootstrap, your changes will be lost. I'd recommend simply moving your stylesheet as well to keep the hierarchical structure found in the unmodified stylesheet.
For example, if you want to move your fonts in the Contents/Fonts folder (I always hate it being loose in the project root folder too haha), have your styles in the Content/Styles folder so that ../fonts/glyphicons-halflings-regular.woff (and so on) still references the correct folder.

Related

How to address the URL of an ashx file

I have successfully added a file, X.ashx and its components (.cs, and so forth) to a project.
The structure is like this:
Solution Z
Project Y
Folder Layouts
Subfolder also named Y
X.ashx
SO the website has an address http://generic/SitePages/Home.aspx for the main file
I would think that one would use something like
http://generic/Y/Layouts/Y/x.ashx as the URL
and I've tried various permutations,
but I cannot get it to work correctly.
Does anyone know how the folder structure maps to a URL?
I am using Visual Studio 2012 and this is for a SharePoint project.
Also, my particular project does NOT have a web.config due to the template used....
Does anyone know of a good downloadable project/template for this in VS2012. I've tried searching but most projects do not have such a template.
Thanks in advance!
assuming you deployed the .ashx file to the layouts folder in the 14 hive, then it should be this:
http://yourdomain/SitePages/_layouts/Y/x.ashx
or
http://yourdomain/_layouts/Y/x.ashx
The Layouts folder gets referenced as _layouts in the url

MVC File Structure Standards

I am just new to MVC, we are building a massive system and have alot of namespacing in our site.
Where is the standard place to store files (CSS, Images, .JS) etc?
Would it be good to put them under the Content folder in sub-folders to their namespace or drop them in with their respective parent files or both.
The default project structure includes a Content folder for CSS files and a Scripts folder for JavaScript files. A lot of people use this existing template, especially since a lot of Nuget projects may rely on this.
I personally like to put all of the content in a Content folder, and have a subfolder under this named Css and Scripts. It's really a matter of preference though. Do whatever is consistent and well-organized. That will be the key to making the application more easily maintainable.
Its better to put it in saparate folder as Script(js file) at root level.
Add sub folder in content folder for Images and Css etc.
we can also create multiple controller and views for each section of your project.
like for login section you can add Authentication Controller.
we can also use Helper class for adding general function and use it in every where.
you can see following link
http://msdn.microsoft.com/en-us/library/dd410120(v=vs.100).aspx

MVC Themes, Layouts and CSS

I am creating an MVC application that will effectively allow a user to upload a number of Themes to the site.
Each theme they upload will have a _Layout.cshtml file, along with css files and images.
These will all be stored in locations mapped to the userId of the person creating the uploads, i.e.:
Users/Themes/32-bit-guid/_Layout.cshtml
Users/Themes/32-bit-guid/css
Users/Themes/32-bit-guid/images
The problem I have, is that although the templates are uploaded and I can select any of the templates (which are then applied to the current logged in user), the CSS files are ignored, along with the images.
If I try to browse to the path Users/Themes/32-bit-guid/css/screen.css which I know exists, I get a resource cannot be found error.
I have had a look at creating custom view engines, ignoring routes and everything, but I am getting no where.
Has anyone experienced this before and can they point me in the right direction please?
Views in MVC require a Web.config, all I did to get the themes working was copy the default web.config file from any Views folder and put it in the same directory as my Layout.cshtml

Using Script.Head() in Orchard CMS

I'm trying to insert a a javascript file I wrote (just a simple alert box) into the header of my Orchard CMS site. My problem is that I can't get the pathing right to lead to the .js file, I've even tried placing my .js file in the website root folder.
Any ideas how to get the path right?
Ah, you are probably missing a web config in the directory where the script is.

What files should go in the ASP.NET MVC Content folder?

I see that ASP.NET MVC generates a Content folder by default, which stores the site.css file. I have a site that uses some image files and XML files in order to do its job, yet I do not want to have those files as embedded resources. Should I just put the files in the solution within the content folder? Should I turn off the "Do not copy" build option on each resource since I will need to deploy the files to the website? Or should these files not even live in the solution and be loaded from the file system?
It's a good approach to add all your files/resources to the solution (at least you can see them in VS ;-) Other developers won't be surprised that your solution really needs some other files.
If those files are the 'content' of your website (like css files) then you can store them in the Content folder. It is up to you what folder structure you come up with. For example you might want to store your images in folder related to the modules of your application, or just all in the images folder. MVC doesn't enforce any particular way of keeping your resource files.
Just leave the Build Action set to Content and Copy to Output Directory to 'Do not copy'.
You might want to take a look at T4MVC project (also available as NuGet package) which will help you in keeping urls to your images / files compile-time safe.

Resources