Hi Henrik,
here ia an example on how to configure the httphandler to ignore
certain file types:
<httpHandlers>
<add path="*.vm" verb="*" type="System.Web.HttpForbiddenHandler"
validate="true"/>
<add path="*.njs" verb="*"
type="System.Web.HttpForbiddenHandler" validate="true"/>
<add path="*.aspx" verb="*"
type="System.Web.UI.PageHandlerFactory" validate="true"/>
<add verb="*" path="*.gif" type="System.Web.StaticFileHandler"/>
<add verb="*" path="*"
type="Castle.MonoRail.Framework.MonoRailHttpHandlerFactory,
Castle.MonoRail.Framework"/>
</httpHandlers>
The example above maps gifs to StaticFileHandler and aspx to
PageHandlerFactory, order is important!!
Cheers
John
On Apr 24, 8:13 pm, "Henrik Feldt" <[email protected]> wrote:
> There’s another problem I’m experiencing as well with routing:
>
> I have multiple http handlers which serve and aggregate specific types of
> data… For normal exists-on-disk files it seems monorail does let them pass
> through, but if there’s a 404, then monorail throws because it can’t find the
> controller/action for whatever I’m requesting…
>
> I can see why monorail wouldn’t parse web.config and interpret the whole
> httpHandlers and httpModules list (in order to figure out what to ignore),
> but for this dynamic file I’d like to add an ignore route; i.e. I don’t want
> the routing module to mess with it at all. Is there a way of doing this
> currently? I can only really find pattern route and rewrite route, which both
> either forces the use of controllers/areas/actions or rewrites (which is not
> what I want), respectively.
>
> The routing module is kind of the problem as without it, monorail doesn’t
> interfere. (which again seems to break the backwards compatibility aim)
>
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Henrik Feldt
> Sent: den 23 april 2009 18:45
> To: [email protected]
> Subject: RE: Bug in MonoRail; Actions' meta-data, (tested with
> SkipFilterAttribute), Routing
>
> Hello Ken,
>
> The problem is if you have some controller running filters and visit an
> action which doesn’t want to run filters which is also named in the same way
> as your routing defaults the name away; the action then does run the filter,
> even if I have a skip filter attribute on it.
>
> I’ve tried the second already, but that gave me errors that there were ‘less
> than two tokens in the url’; that’s why I pasted code in part 2 of my e-mail;
> that is the code that runs if I use your mapping.
>
> This is on trunk…
>
> Regards,
>
> Henrik
>
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Ken Egozi
> Sent: den 23 april 2009 07:58
> To: [email protected]
> Subject: Re: Bug in MonoRail; Actions' meta-data, (tested with
> SkipFilterAttribute), Routing
>
> I'm not sure I understand your first concern,
>
> as for the latter - siteroot rule can be registered with /[controller].
> see
> here:http://www.kenegozi.com/blog/2009/02/10/monorail-routing-and-the-home...
>
> On Thu, Apr 23, 2009 at 9:22 AM, Henrik Feldt <[email protected]> wrote:
>
> I have this code:
>
> [SkipFilter(typeof(AntiCrossSiteRequestForgeryFilter))]
>
> public void index()
>
> If you also register this:
>
> RoutingModuleEx.Engine.Add(
>
> new PatternRoute("Area Route", "/<area>/<controller>/[action]")
>
> .DefaultForAction().Is("index")
>
> );
>
> Then the ActionMetaDescriptor will not contain information about the correct
> index method; i.e. the collection of skip filters;
>
> /// <summary>
>
> /// Pendent
>
> /// </summary>
>
> /// <param name="filterType">Type of the filter.</param>
>
> /// <returns></returns>
>
> public bool ShouldSkipFilter(Type filterType)
>
> {
>
> foreach(SkipFilterAttribute skip in
> actionMetaDescriptor.SkipFilters)
>
> {
>
> if (skip.FilterType == filterType)
>
> {
>
> return true;
>
> }
>
> }
>
> return false;
>
> }
>
> will _NOT_ be found/correct/filled up, i.e. the filter will not be skipped
> and the app crashes (or rather denies access).
>
> Part 2
>
> I was also wondering why this part is here:
>
> if (parts.Length < 2)
>
> {
>
> throw new UrlTokenizerException("Url smaller than 2 tokens");
>
> }
>
> In DefaultUrlTokenizer.ExtractAreaControllerAction(…)
>
> ?
>
> Because if I have
>
> www.site.com
>
> there are no parts. I hence can’t register route pattern “/” and place that
> into a controller/action-pair, or is there a way around this? The
> documentation states:
>
> Site root
>
> As an user I should be able to register a definition mapping the site root
> (aka ~/) to an area (optional), controller and action.
>
> Pattern:
>
> /
>
> Name:
>
> siteroot (set by the user)
>
> Area:
>
> null
>
> controller
>
> Home
>
> action
>
> index
>
> Request URL / (or virtualdir/) should match the above rule.
>
> Request URL /something (or virtualdir/something) should NOT match the above
> rule.
>
> Url generation for the above rule MUST use the name
>
> Here:http://using.castleproject.org/display/MR/Routing+Spec
>
> But that doesn’t work either…
>
> --
> Ken
> Egozi.http://www.kenegozi.com/bloghttp://www.delver.comhttp://www.musicglue.comhttp://www.castleproject.orghttp://www.gotfriends.co.il
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Development List" 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-devel?hl=en
-~----------~----~----~----~------~----~------~--~---