This project is read-only.

Subfolders not allowed ?

Dec 14, 2010 at 11:19 AM


I have a simple server that works....

server = new Server();

server.Resources.Add(new FileResources("/", ExecutingFolder() + "\\webpages\\"));
server.Add(new FileModule(server.Resources, false);

HttpListener listener = HttpListener.Create(....);

server.Add(new HttpServer.Routing.SimpleRouter("/","/index.html"));
server.RequestReceived += ServerRequestReceived;


Now I want to do a test with some pages, so inside the "webpages" folder I have created a subfolder named 'tt'. In the "webpages\tt" i have an index.html which is nicely served by the webserver. However the .css and .js files (who are in subfolders of the tt folder) are not served at all. no matter what pathname I use in the .html file, I cannot get these .css and .js files to load unless(!!) they reside in the root folder of the webserver.

How should I have the webserver honor the pathname I put in my .html file - as long as it is a subfolder of the root ? -AND- without modifying the code everytime I want to add a folder ?

Dec 29, 2010 at 4:00 PM

I've just done some testing with images and sub folders. I got no problem. I've updated the WebServerSample. It now contains two images, both in sub folders + a stylesheet in a sub folder.

Have you made sure that your resources are copied to the output folder when building? The "Copy" file property must be set to "copy always" or "copy if newer"

I've checked in my samples.