Multiple FileResources

Feb 15, 2011 at 6:38 PM

Am i being a dullard here (very likely!) or are multiple FileResources not supported?

I am trying to have selected URLs go to different folders and adding the resources like this:

            var module = new FileModule();
            module.Resources.Add(new FileResources("/assets/", YAMS.Core.RootFolder + "\\web\\assets\\"));

            //Add any server specific folders
            SqlCeDataReader readerServers = YAMS.Database.GetServers();
            while (readerServers.Read())
            {
                var intServerID = readerServers["ServerID"].ToString();
                string strURI = "/" + intServerID + "/map/";
                string strPath = YAMS.Core.RootFolder + "\\servers\\" + intServerID + "\\renders\\gmap\\output\\";
                module.Resources.Add(new FileResources(strURI, strPath));
            }
            myServer.Add(module);

            //Handle requests to API
            myServer.Add(new API());

(if it's any help the rest of the source file is on github)

the first set (to /assets/) works but every other call goes to my custom module (API).  I was expecting that opening /1/map/ should open the \servers\1\renders\gmap\output\ folder but it drops through to my API.

It's definitely dropping into the loop and is creating the right path and uri vars, so not really sure what I'm doing wrong.

Using 2.0 with a build from around 3rd December.  Tried latest trunk and it broke in a number of places.

Perfectly happy to accept it's something I'm doing wrong, I'm fairly new to C#!

Feb 16, 2011 at 2:05 PM

Ok, so turns out I was being a dullard.

I assumed (incorrectly) that file resource calls would override the API calls.  This works for the /assets/ but not for the other URLs.  If I stop my API from capturing any URI and doing a .Continue, then these resources work fine.

I thought it might be because the URIs are multi-level, but switching to just /map/ didn't work either, so not sure what is happening!  Will just have to write API to be more specific with the URLs it handles.