I'm attempting to set up my own directory structure for serving up static files:
\s (statics)
\c (css)
\j (js)
\i (images)
etc ...
The issue is that I'm seeing a 404 for this directory when referencing it. When I inspect the file path, it is pointing to the correct location localhost:port/s/c/style.css, but for some reason it can't find the file.
Is there a way that I can make this path available via my Web.config, or possibly through my Global.asax file via routes? I've heard there are performance penalties associated with using routes, so using the Web.config - or an alternative solution - is preferred.
http://localhost:port/s/c/style.css should work without any problems. It seems that you have specified a wrong filename which is the reason for the 404 error.
Related
I have always thought the api controllers where not found by physical paths. The reason I ask is I have a website example.com I created a folder example.com/testing and uploaded my project to there. When I ran it I got errors saying that none of the apiControllers could be found. So I changed /api/apiCustomers to /testing/api/apiCustomers. It then worked, well not the actual posting of any new records. It did locate and retrieve all the records from the database though. But it doesn't seem like that is what I would actually need to do? I have a domain with WinHost and the default publish folder is example.com/myApp
AM I looking at this the wrong way?
To handle request where you do not know the root path, you can use (as in ASP.NET) the ~-character like this:
~/api/apiCustomers
~ will then be replaced by the root (i.e. /api/apiCustomers for prod and /testing/api/apiCustomers for your test environment)
When using Dojo file caching with Worklight receiving a 404 Error when running in Simulator. It appears the file being loaded is not being copied from the common area to the device. Is there something else I need to define in my project to make that happen? There must be a convention and I wanted to follow it going forward as I expect to have more template files in the project.
My define statement in a .js file:
define(["dojo/_base/lang", "dijit/layout/ContentPane", "dojo/dom", "dojo/text!./templates/Order.html"], function(lang, ContentPane, dom, template){
...
var cp1 = new ContentPane({
title:"Order",
content: lang.replace(template, someJson)
}).placeAt("temp");
My folder structure:
In the common/js directory I have the above code in a .js file and I have a templates folder to keep the Order.html and I would expect to have other template files stored there in the future.
Error on the console:
GET http://localhost:10080/DojoProject/apps/services/preview/DojoApp/windowsphone8/1.0/default/layers/templates/Order.html 404 (Not Found)
It seems that the way you are specifying the path, browser tries to find the file in the "layers" folder which is sibling to "templates".
Have you tried to modify the "dojo/text!./templates/Order.html" to something like: "dojo/text!./../templates/Order.html" to navigate one level up, then go into the templates folder?
I'm not sure this will work, but I think it worths a try.
I'm using GroceryCRUD to act as a front end for a database containing news releases. Secretaries can go in and add/edit/delete news releases in the database easily now. Only qualified users are able to access the application root via an .htaccess password. The problem with this is that GroceryCRUD uploads assets such as photos are uploaded to the directory /www/approot/assets/uploads/ which is password protected since /approot/ is protected.
My ideal solution would be to set an upload directory outside of the application root which is where I'm running into trouble. By default this is how GroceryCRUD handles uploads:
$this->grocery_crud->set_field_upload('photo1','assets/uploads/');
I've tried changing it to something like this:
$this->grocery_crud->set_field_upload('photo1','/public/assets/uploads/');
I was hoping this / would make the path start from the document root instead of the application root, but it throws this error:
PHP Fatal error: Uncaught exception 'Exception' with message 'It
seems that the folder "/Users/myusername/www/approot//public/assets/uploads/"
for the field name "photo1" doesn't exists.
This seems to suggest that CI or GroceryCRUD just takes the second argument in set_upload field and just concatenates it onto the end of the site URL that is defined. Is there any way around this that doesn't involve creating a user login system?
Try using relative path.
$this->grocery_crud->set_field_upload('photo1','../assets/uploads/');
.. -> Go up one directory
I ended up implementing a login system outlined in this tutorial:
http://net.tutsplus.com/tutorials/php/easy-authentication-with-codeigniter/
It was quite simple to set up and suits my needs. I found ways to give access to the directory using httpd.conf directives but I feel like this was a more viable solution since I don't have direct access to server configuration files.
Maybe in the future GroceryCRUD will allow placement of uploads outside the application folder.
I did not find which is the best following to serve physical files to the users in a MVC3 app.
For example if I want to put my site in search engines, they ask me to place an xml file in the site root.
This file can not be accessed because I think the routing does not "catch" the url...
Thanks¡¡
You should be able to ignore route:
routes.IgnoreRoute("/filename.xml");
Or:
routes.IgnoreRoute("filename.xml");
And that should be done in Global.asax file and RegisterRoutes() function
did you try opening the file through your web browser?
if you tried and it didn't open then you can do the following
in global.asax
write the following
C#
routes.IgnoreRoute("{xml}", new { xml = #"(.)?abc.xml" }); where abc is the file name or you can but * instead of abc to ignore all xml files
You can just set the permissions on the file system with a chmod (700) or equivalent. Usually this is where the protections come in.
Installing Sparks assumes that you are abiding by the default CodeIgniter installation pattern; extracting the application, system, and user guide folders, along with with a index.php and a license file into your web root.
However, many of us pull the application and system folders out of the web root for security reasons and re-route the $system_path and $application_folder variables in the main index.php file.
This separation tends to break Spark installs. In particular, the simple example-spark used in the getsparks installation instructions.
Getting an error:
An Error Was Encountered Cannot find
spark path at
sparks/example-spark/1.0.0/
I maintain the following directory structure:
CISYS
V202
V200
project1_application
project2_application
project3_application
www (public html)
project1
css
js
images
etc
project2
etc
What must I reroute to achieve both security + sparks? Open to suggestions of any sort. How do you set up your installation?
To answer my own question: The solution was in the MY_Loader.php file. By modifying the SPARKPATH variable on line 43, one can reroute the location of all sparks! Cheers!