Ok, as I said a few posts ago, I spotted the following code in
OnBeginRequest in RoutingModuleEx:

if (File.Exists(request.PhysicalPath))
{
       return; // Possibly requesting a static file, so we skip
routing altogether
}

This explicitly prevents using new routing for the old routing
scenario which Ken and I just discussed. Sure enough, I removed this
code and did a build of Monorail and this gets me the behaviour I
expect.

This leads me to the question: should routing be bypassed like this?
Would it be better if there was some kind of check for a matching
route even if the physical file exists?

On Mon, Nov 24, 2008 at 3:34 PM, Colin Ramsay <[EMAIL PROTECTED]> wrote:
> ah, right, yes - I was able to get it to work with the old routing as
> I said. For reference, I just tried my below setup on IIS6 / Server
> 2003 and still got the "Url smaller than 2 tokens".
>
> On Mon, Nov 24, 2008 at 3:23 PM, Ken Egozi <[EMAIL PROTECTED]> wrote:
>> old routing ...
>>
>> On Mon, Nov 24, 2008 at 5:21 PM, Colin Ramsay <[EMAIL PROTECTED]> wrote:
>>>
>>> I've got that same set up then, Default.aspx as the default document
>>> in IIS and then the empty file is present. My route is:
>>>
>>> rules.Add(
>>>       new PatternRoute("/Default.aspx")
>>>               .DefaultForController().Is("staticcontent")
>>>               .DefaultForAction().Is("home")
>>> );
>>>
>>> This gives me the "Url smaller than 2 tokens" error. I'm using IIS 5.1
>>> on XP though....
>>>
>>> On Mon, Nov 24, 2008 at 3:07 PM, Ken Egozi <[EMAIL PROTECTED]> wrote:
>>> > it's the default document in IIS
>>> > and there's an empty file with that name in the root.
>>> >
>>> > fools IIS6
>>> >
>>> >
>>> >
>>> > On Mon, Nov 24, 2008 at 4:42 PM, Colin Ramsay <[EMAIL PROTECTED]>
>>> > wrote:
>>> >>
>>> >> Do you actually have a physical default.aspx page?
>>> >>
>>> >> On Mon, Nov 24, 2008 at 2:35 PM, Ken Egozi <[EMAIL PROTECTED]> wrote:
>>> >> > I mapped .aspx to .net (very shared-hosting friendly), then had a
>>> >> > rule
>>> >> > from
>>> >> > /default.aspx to home/index.aspx
>>> >> >
>>> >> >
>>> >> > On Mon, Nov 24, 2008 at 4:32 PM, Colin Ramsay <[EMAIL PROTECTED]>
>>> >> > wrote:
>>> >> >>
>>> >> >> I'm pretty sure that with the old routing I mapped everything to
>>> >> >> *.html (as opposed to *.castle) and then had a rule like:
>>> >> >>
>>> >> >> /index.html
>>> >> >> /home/index.html
>>> >> >>
>>> >> >> That allowed my homepage to look like http://www.mysite.com, i.e.
>>> >> >> with
>>> >> >> no /index.html or /home/index.html when you hit the homepage. In
>>> >> >> that
>>> >> >> case I definitely didn't map "*".
>>> >> >>
>>> >> >> On Mon, Nov 24, 2008 at 2:28 PM, Jimmy Shimizu
>>> >> >> <[EMAIL PROTECTED]>
>>> >> >> wrote:
>>> >> >> >
>>> >> >> > Don't you need to map * as handler in order to use site-root
>>> >> >> > routing?
>>> >> >> >
>>> >> >> > Colin Ramsay wrote:
>>> >> >> >> Additionally on this, if I change my application extension to
>>> >> >> >> .aspx
>>> >> >> >> then the Default.aspx will trigger a " Url smaller than 2 tokens"
>>> >> >> >> exception. I guess this is because of the following code in
>>> >> >> >> OnBeginRequest in RoutingModuleEx:
>>> >> >> >>
>>> >> >> >> if (File.Exists(request.PhysicalPath))
>>> >> >> >> {
>>> >> >> >>       return; // Possibly requesting a static file, so we skip
>>> >> >> >> routing
>>> >> >> >> altogether
>>> >> >> >> }
>>> >> >> >>
>>> >> >> >> On Sun, Nov 23, 2008 at 4:34 PM, Colin Ramsay
>>> >> >> >> <[EMAIL PROTECTED]>
>>> >> >> >> wrote:
>>> >> >> >>
>>> >> >> >>> I'm still working on this documentation as I think it's useful
>>> >> >> >>> to
>>> >> >> >>> have
>>> >> >> >>> something down even if it's going to change in future. I'm
>>> >> >> >>> looking
>>> >> >> >>> at
>>> >> >> >>> the default rule:
>>> >> >> >>>
>>> >> >> >>> rules.Add(
>>> >> >> >>>    new PatternRoute("/")
>>> >> >> >>>        .DefaultForController().Is("staticcontent")
>>> >> >> >>>        .DefaultForAction().Is("home")
>>> >> >> >>> );
>>> >> >> >>>
>>> >> >> >>> Obviously this should match thusly:
>>> >> >> >>>
>>> >> >> >>> [TestMethod]
>>> >> >> >>> public void Root()
>>> >> >> >>> {
>>> >> >> >>>    RoutingRules.Register(RoutingModuleEx.Engine);
>>> >> >> >>>
>>> >> >> >>>    RouteMatch match = RoutingModuleEx.Engine.FindMatch("/",
>>> >> >> >>> CreateGetContext());
>>> >> >> >>>
>>> >> >> >>>    Assert.IsNotNull(match);
>>> >> >> >>>    Assert.AreEqual("staticcontent",
>>> >> >> >>> match.Parameters["controller"]);
>>> >> >> >>>    Assert.AreEqual("home", match.Parameters["action"]);
>>> >> >> >>> }
>>> >> >> >>>
>>> >> >> >>> The trouble is that when I'm running through IIS I cannot get
>>> >> >> >>> this
>>> >> >> >>> to
>>> >> >> >>> match. If I do not have a Default.aspx placeholder, I get a
>>> >> >> >>> directory
>>> >> >> >>> listing. If I have a Default.aspx then I see the contents of
>>> >> >> >>> Default.aspx. Incidentally the extension i'm using for my
>>> >> >> >>> application
>>> >> >> >>> is .ashx at the moment.
>>> >> >> >>>
>>> >> >> >>> On Wed, Nov 19, 2008 at 9:49 PM, Colin Ramsay
>>> >> >> >>> <[EMAIL PROTECTED]>
>>> >> >> >>> wrote:
>>> >> >> >>>
>>> >> >> >>>> I think it would definitely be of benefit to try and state the
>>> >> >> >>>> problem
>>> >> >> >>>> to provide context to the rest of the documentation, if nothing
>>> >> >> >>>> else,
>>> >> >> >>>> and if that helps define a better solution then that's a good
>>> >> >> >>>> side
>>> >> >> >>>> benefit.
>>> >> >> >>>>
>>> >> >> >>>> On Wed, Nov 19, 2008 at 8:44 PM, hammett <[EMAIL PROTECTED]>
>>> >> >> >>>> wrote:
>>> >> >> >>>>
>>> >> >> >>>>> Given the fact that I've been writing specs for the last 3
>>> >> >> >>>>> months, I
>>> >> >> >>>>> wonder if we should try this for the routing stuff.
>>> >> >> >>>>>
>>> >> >> >>>>> The spec - at least on devdiv - is a definition of behavior,
>>> >> >> >>>>> public
>>> >> >> >>>>> API, consideration and issues. It is also used to create the
>>> >> >> >>>>> documentation. Would that lead to waterfalling a supposedly
>>> >> >> >>>>> agile
>>> >> >> >>>>> environment? I'm not sure. What I know is that I've spent many
>>> >> >> >>>>> hours
>>> >> >> >>>>> writing and refactoring the routing stuff without a clear and
>>> >> >> >>>>> agreeable definition of the whole problem space.
>>> >> >> >>>>>
>>> >> >> >>>>> Thoughts?
>>> >> >> >>>>>
>>> >> >> >>>>>
>>> >> >> >>>>> On Wed, Nov 19, 2008 at 5:54 AM, Colin Ramsay
>>> >> >> >>>>> <[EMAIL PROTECTED]> wrote:
>>> >> >> >>>>>
>>> >> >> >>>>> --
>>> >> >> >>>>> Cheers,
>>> >> >> >>>>> hammett
>>> >> >> >>>>> http://hammett.castleproject.org/
>>> >> >> >>>>>
>>> >> >> >>>>>
>>> >> >> >>
>>> >> >> >> >
>>> >> >> >>
>>> >> >> >
>>> >> >> > >
>>> >> >> >
>>> >> >>
>>> >> >>
>>> >> >
>>> >> >
>>> >> >
>>> >> > --
>>> >> > Ken Egozi.
>>> >> > http://www.kenegozi.com/blog
>>> >> > http://www.delver.com
>>> >> > http://www.musicglue.com
>>> >> > http://www.castleproject.org
>>> >> > http://www.gotfriends.co.il
>>> >> >
>>> >> > >
>>> >> >
>>> >>
>>> >>
>>> >
>>> >
>>> >
>>> > --
>>> > Ken Egozi.
>>> > http://www.kenegozi.com/blog
>>> > http://www.delver.com
>>> > http://www.musicglue.com
>>> > http://www.castleproject.org
>>> > http://www.gotfriends.co.il
>>> >
>>> > >
>>> >
>>>
>>>
>>
>>
>>
>> --
>> Ken Egozi.
>> http://www.kenegozi.com/blog
>> http://www.delver.com
>> http://www.musicglue.com
>> http://www.castleproject.org
>> http://www.gotfriends.co.il
>>
>> >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to