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.
Related
When I change content of our web site from umbraco and try to preview it is not working. This is because the required umbraco js and css files are not loaded. Our site is hosted in a IIS virtual directory(eg: /localhost/mySite)
The correct path should be for the umbraco files should be,
http://localhost/mySite/umbraco/assets/css/canvasdesigner.css
but the js and css file paths are taken as,
http://localhost/umbraco/assets/css/canvasdesigner.css
Does anyone know how to solve this?
I think this is an issue with relative URL's within Umbraco - you should try setting up your web site as a new web site in IIS with a new record in your hosts file.
You need to make a change to your /config/umbracoSettings.config
Add true under in the umbracoSettings.config file in the config folder.
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.
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
When inside a View, within MVC, and you have your JavaScript, I tried to move it to a JavaScript file in the same directory, and it reports it can not file the javascript file
As an example I user NerdDinner and the DinnerForm.aspx, created a JavaScript file in the same directory as the DinnerForm.aspx called DinnerForm.js and referenced it in the aspx file, as below:
Here is the issue, I need to keep my JavaScript file near if not in the same directory in the project as DinnerForm.aspx, how do I go about doing this?
I don't want to place the full path, eg: "~\views\dinners\dinnerform.js" as this is just a work around, and will cause issues later
Any ideas?
You can't have the JavaScript files in the Views folder as it does not actually exist to the browser. If you have a look at the Web.config file in the Views folder, you'll see that it is set to the HttpNotFoundHandler handler. That means it returns 404 for all requests to its folder.
Why not put them in the Scripts folder? You could always have sub folder under it.
E.g. /Scripts/Dinner/dinnerform.js
JavaScript files by convention should be placed in project's Scripts folder and could be linked as
<script src="<%= Url.Content("~/Scripts/jquery-1.3.2.js") %>"
I will like add conventional HTML page under VIEWS folder (in ASp.NET MVC) page.
I have added the route exceptions as mentioned below.
routes.IgnoreRoute("{resource}.htm/{*pathInfo}")
routes.IgnoreRoute("{resource}.html/{*pathInfo}")
Although it does work when I put the html files out of VIEWS folder but I get Page not found 404 when I put those in VIEWS folder. I am also unable to browse the VIEWS folder by setting directory browsing option in IIS.
Please help me on HOW to access HTML file from VIEWS folder.
I think that it's a mistake to mix your HTML content with your views. I'd suggest that you create a separate static folder under Content and put your HTML there. You can create an analogous directory structure to your view structure if necessary for management. Then you don't need to do anything special in order to able to reference the files. You can even, then, open them up to editing with Contribute, etc. by people who are allowed to modify static content.
+-Content
+-Images
+-Static
+-Account
+-privacy.html
+-refunds.html
+-Styles
Usage:
<a href='<%= Url.Content( "~/Content/Static/Account/privacy.html" ) %>'>Privacy Policy</a>
The default Views folder has an Web.config file that explicitly gives 404 errors for all requests. You just need to edit and enable for HTML files (or all files, but then people might snoop).